mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 07:21:05 +00:00
Change innerText note to reflect that we used textContent
This commit is contained in:
parent
d1fc7895f6
commit
8ba9e7b05d
@ -1805,9 +1805,10 @@ var htmx = (function() {
|
|||||||
}
|
}
|
||||||
const settleInfo = makeSettleInfo(target)
|
const settleInfo = makeSettleInfo(target)
|
||||||
|
|
||||||
|
// For text content swaps, don't parse the response as HTML, just insert it
|
||||||
if (swapSpec.swapStyle === 'textContent') {
|
if (swapSpec.swapStyle === 'textContent') {
|
||||||
// parse only as text; don't process OOB swaps
|
|
||||||
target.textContent = content
|
target.textContent = content
|
||||||
|
// Otherwise, make the fragment and process it
|
||||||
} else {
|
} else {
|
||||||
let fragment = makeFragment(content)
|
let fragment = makeFragment(content)
|
||||||
|
|
||||||
|
@ -241,9 +241,9 @@ Keep in mind that the JSON you parse might have a *property* that is formatted a
|
|||||||
{ "name": "<script>alert('Hahaha I am a script')</script>" }
|
{ "name": "<script>alert('Hahaha I am a script')</script>" }
|
||||||
```
|
```
|
||||||
|
|
||||||
Therefore, don't insert JSON values as HTML either—use `innerText` if you're doing something like that. This is well outside the realm of htmx-controlled UI though.
|
Therefore, don't insert JSON values as HTML either—use `textContent` if you're doing something like that. This is well outside the realm of htmx-controlled UI though.
|
||||||
|
|
||||||
The 2.0 version of htmx will include an `innerText` swap, if you want to call someone else's API directly from the client and just put that text into the page.
|
The 2.0 version of htmx will include a `textContent` swap, if you want to call someone else's API directly from the client and just put that text into the page.
|
||||||
|
|
||||||
### Custom HTML controls
|
### Custom HTML controls
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user