Documentation ¶
Overview ¶
Package dom is wraps HTMLElement. It also includes Bootstrap (4).
Index ¶
- func AppendChild(child interface{})
- func RemoveChild(child *Element)
- type Element
- func (e *Element) AddClass(names ...string) *Element
- func (e *Element) Append(child ...interface{}) *Element
- func (e *Element) Attr(name string) string
- func (e *Element) Call(name string, args ...interface{}) js.Value
- func (e *Element) Clone() *Element
- func (e *Element) Data(key, value string) *Element
- func (e *Element) Empty() *Element
- func (e *Element) Free()
- func (e *Element) HTML() string
- func (e *Element) HasClass(name string) bool
- func (e *Element) On(event string, fn func(*Element, *js.Event)) *Element
- func (e *Element) OnChange(fn func(*Element, *js.Event)) *Element
- func (e *Element) OnClick(fn func(*Element, *js.Event)) *Element
- func (e *Element) Prepend(child interface{}) *Element
- func (e *Element) Prop(name string) js.Value
- func (e *Element) RemoveAttr(name string) *Element
- func (e *Element) RemoveChild(elm *Element) *Element
- func (e *Element) RemoveClass(names ...string) *Element
- func (e *Element) ReplaceClass(oldName, newName string) *Element
- func (e *Element) S(selector string) *Element
- func (e *Element) SS(selector string) ElementList
- func (e *Element) SetAttr(name, value string) *Element
- func (e *Element) SetHTML(html string) *Element
- func (e *Element) SetProp(name string, val interface{}) *Element
- func (e *Element) SetText(text string) *Element
- func (e *Element) SetVal(val interface{}) *Element
- func (e *Element) String() string
- func (e *Element) TagName() string
- func (e *Element) Text() string
- func (e *Element) ToggleClass(name string) *Element
- func (e *Element) Truthy() bool
- func (e *Element) Val() string
- type ElementList
- func (nl ElementList) AddClass(names ...string) ElementList
- func (nl ElementList) Append(x ...*Element) ElementList
- func (nl ElementList) AppendList(other ElementList) ElementList
- func (nl ElementList) Attr(name string) []string
- func (nl ElementList) Foreach(fn func(idx int, v *Element))
- func (nl ElementList) HasClass(name string) ElementList
- func (nl ElementList) Length() int
- func (nl ElementList) Prop(name string) []js.Value
- func (nl ElementList) RemoveClass(names ...string) ElementList
- func (nl ElementList) ReplaceClass(oldName, newName string) ElementList
- func (nl ElementList) SetAttr(name, value string) ElementList
- func (nl ElementList) SetProp(name string, flag bool) ElementList
- func (nl ElementList) SetVal(val interface{}) ElementList
- func (nl ElementList) TagName() []string
- func (nl ElementList) ToggleClass(name string) ElementList
- func (nl ElementList) Val() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Element ¶
type Element struct {
*js.EventTarget
}
Element represents a HTML element.
func (*Element) Clone ¶
Clone clones the element. https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode.
func (*Element) RemoveAttr ¶
RemoveAttr removes soem attribute.
func (*Element) RemoveChild ¶
RemoveChild removes child element.
func (*Element) RemoveClass ¶
RemoveClass remove class from element.
func (*Element) ReplaceClass ¶
ReplaceClass replace some class of element with new one.
func (*Element) SS ¶
func (e *Element) SS(selector string) ElementList
SS returns children by query selector condition.
func (*Element) ToggleClass ¶
ToggleClass toggle some class of element.
type ElementList ¶
type ElementList []*Element
ElementList is a collection of elements.
func ElementListOf ¶
func ElementListOf(v js.Value) ElementList
ElementListOf returns a element list.
func SS ¶
func SS(selector string) ElementList
SS returns elements in document with query selector condition.
func (ElementList) AddClass ¶
func (nl ElementList) AddClass(names ...string) ElementList
AddClass adds class to all elements.
func (ElementList) Append ¶
func (nl ElementList) Append(x ...*Element) ElementList
Append add a new element.
func (ElementList) AppendList ¶
func (nl ElementList) AppendList(other ElementList) ElementList
AppendList appends other list.
func (ElementList) Attr ¶
func (nl ElementList) Attr(name string) []string
Attr returns some attribute values.
func (ElementList) Foreach ¶
func (nl ElementList) Foreach(fn func(idx int, v *Element))
Foreach apply function on each element.
func (ElementList) HasClass ¶
func (nl ElementList) HasClass(name string) ElementList
HasClass returns elements which has specific class.
func (ElementList) Prop ¶
func (nl ElementList) Prop(name string) []js.Value
Prop returns some property values.
func (ElementList) RemoveClass ¶
func (nl ElementList) RemoveClass(names ...string) ElementList
RemoveClass remove some class from all elements.
func (ElementList) ReplaceClass ¶
func (nl ElementList) ReplaceClass(oldName, newName string) ElementList
ReplaceClass replace some class with new one on all elements.
func (ElementList) SetAttr ¶
func (nl ElementList) SetAttr(name, value string) ElementList
SetAttr sets attribute to all elements.
func (ElementList) SetProp ¶
func (nl ElementList) SetProp(name string, flag bool) ElementList
SetProp sets property to all elements.
func (ElementList) SetVal ¶
func (nl ElementList) SetVal(val interface{}) ElementList
SetVal set value to all elements.
func (ElementList) TagName ¶
func (nl ElementList) TagName() []string
TagName returns all tag names.
func (ElementList) ToggleClass ¶
func (nl ElementList) ToggleClass(name string) ElementList
ToggleClass toggles some class on all elements.
Directories ¶
Path | Synopsis |
---|---|
Package bs is a Bootstrap toolkit.
|
Package bs is a Bootstrap toolkit. |
alert
Package alert wraps Bootstrap Alert component
|
Package alert wraps Bootstrap Alert component |
badge
Package badge wraps Bootstrap Badge component
|
Package badge wraps Bootstrap Badge component |
button
Package button wraps Bootstrap Button component.
|
Package button wraps Bootstrap Button component. |
card
Package card wraps Bootstrap Card component.
|
Package card wraps Bootstrap Card component. |
list
Package list wraps Bootstrap List Group component.
|
Package list wraps Bootstrap List Group component. |
modal
Package modal wraps Bootstrap Modal component.
|
Package modal wraps Bootstrap Modal component. |
progress
Package progress wraps Bootstrap Progress component.
|
Package progress wraps Bootstrap Progress component. |
spinner
Package spinner wraps Bootstrap spinner component.
|
Package spinner wraps Bootstrap spinner component. |
table
Package table wraps Bootstrap default Table Content.
|
Package table wraps Bootstrap default Table Content. |