-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathdocument_js.go
34 lines (26 loc) · 1 KB
/
document_js.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package wasm
// This file implements Document interface
// https://developer.mozilla.org/en-US/docs/Web/API/Document
// Properties
// Returns the currently focused element
// https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement
func (v Value) ActiveElement() Value {
return Value{v.Get("activeElement")}
}
// Methods
// https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement
func (v Value) CreateElement(tag string) Value {
return Value{Document.Call("createElement", tag)}
}
// https://developer.mozilla.org/en-US/docs/Web/API/Document/createTextNode
func (v Value) CreateTextNode(textContent string) Value {
return Value{Document.Call("createTextNode", textContent)}
}
// https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById
func (v Value) GetElementById(id string) Value {
return Value{v.Call("getElementById", id)}
}
// https://developer.mozilla.org/en-US/docs/Web/API/Document/write
func (v Value) Write(markup string) {
Document.Call("write", markup)
}