kelo
/
element.go
54 строки · 1.0 Кб
1package godom
2
3import "gitverse.ru/metalcore/kelo/wrapper"
4
5type ElementValuer interface {
6NodeValuer
7
8ClassName() string
9SetClassName(string) ElementValuer
10Id() string
11SetId(id string) ElementValuer
12InnerHTML() string
13SetInnerHTML(string) ElementValuer
14TagName() string
15}
16
17type Element struct {
18Node
19}
20
21func NewElement(v wrapper.JSValuer) *Element {
22return &Element{*NewNode(v)}
23}
24
25func (e *Element) ClassName() string {
26return e.GetJS().Get("className").String()
27}
28
29func (e *Element) SetClassName(className string) ElementValuer {
30e.GetJS().Set("className", className)
31return e
32}
33
34func (e *Element) Id() string {
35return e.GetJS().Get("id").String()
36}
37
38func (e *Element) SetId(id string) ElementValuer {
39e.GetJS().Set("id", id)
40return e
41}
42
43func (e *Element) InnerHTML() string {
44return e.GetJS().Get("className").String()
45}
46
47func (e *Element) SetInnerHTML(innerHTML string) ElementValuer {
48e.GetJS().Set("innerHTML", innerHTML)
49return e
50}
51
52func (e *Element) TagName() string {
53return e.GetJS().Get("tagName").String()
54}
55