mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-27 13:01:03 +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)
|
||||
|
||||
// For text content swaps, don't parse the response as HTML, just insert it
|
||||
if (swapSpec.swapStyle === 'textContent') {
|
||||
// parse only as text; don't process OOB swaps
|
||||
target.textContent = content
|
||||
// Otherwise, make the fragment and process it
|
||||
} else {
|
||||
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>" }
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user