/
body.go
38 lines (29 loc) · 847 Bytes
/
body.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
package elements
import (
"github.com/gopherjs/gopherjs/js"
"go.dev.pztrn.name/bulpherjs/common"
"go.dev.pztrn.name/bulpherjs/metas"
)
// Body is a controlling structure for "body" HTML head element.
type Body struct {
metas.Generic
}
// NewBody creates new "body" HTML element controlling structure.
func NewBody() *Body {
b := &Body{}
b.initialize()
return b
}
// Build builds child elements.
func (b *Body) Build() *js.Object {
// This function is special - we should try to get <body> element only
// after DOMContentLoaded event was fired, otherwise there is no
// guarantee that <body> will ever exist.
b.Object = js.Global.Get(common.HTMLElementDocument).Get(common.HTMLElementBody)
b.BuildChilds(b.Object)
return b.Object
}
// Initializes controlling structure.
func (b *Body) initialize() {
b.InitializeGeneric()
}