-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathdocument.go
40 lines (30 loc) · 1.13 KB
/
document.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
35
36
37
38
39
40
package godom
// 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 (o *Object) ActiveElement() *Object {
return &Object{o.Get("activeElement")}
}
// Properties
func (o *Object) DocumentElement() *Object {
return &Object{o.Get("documentElement")}
}
// Methods
// https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement
func (o *Object) CreateElement(tag string) *Object {
return &Object{Document.Call("createElement", tag)}
}
// https://developer.mozilla.org/en-US/docs/Web/API/Document/createTextNode
func (o *Object) CreateTextNode(textContent string) *Object {
return &Object{Document.Call("createTextNode", textContent)}
}
// https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById
func (o *Object) GetElementById(id string) *Object {
return &Object{o.Call("getElementById", id)}
}
// https://developer.mozilla.org/en-US/docs/Web/API/Document/write
func (o *Object) Write(markup string) {
Document.Call("write", markup)
}