1
0
mirror of https://github.com/taigrr/wasm-experiments synced 2025-01-18 04:03:21 -08:00
Johan Brandhorst e481a67ae8
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.
2018-08-17 10:26:43 +01:00

21 lines
300 B
Go

// +build js,wasm
package main
import "syscall/js"
var document js.Value
func init() {
document = js.Global().Get("document")
}
func main() {
div := document.Get("body")
node := document.Call("createElement", "div")
node.Set("innerText", "Hello jsgo.io!")
div.Call("appendChild", node)
}