mirror of
https://github.com/taigrr/wasm-experiments
synced 2025-01-18 04:03:21 -08:00
Use innerText instead of innerHTML to discourage XSS risks
Roberto Clapis (@empijei) pointed out to me that using innerHTML for unformatted text is bad practice, so I've switched to using innerText and SetTextContent instead.
This commit is contained in:
@@ -14,7 +14,7 @@ func main() {
|
||||
div := document.Call("getElementById", "target")
|
||||
|
||||
node := document.Call("createElement", "div")
|
||||
node.Set("innerHTML", "Hello World")
|
||||
node.Set("innerText", "Hello World")
|
||||
|
||||
div.Call("appendChild", node)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user