Documentation
¶
Rendered for js/wasm
Index ¶
- Variables
- func Alert(a ...interface{})
- func Alertf(format string, a ...interface{})
- func Append(children ...interface{})
- func IsObject(v Value) bool
- func Prepend(children ...interface{})
- type Event
- type EventTarget
- type Fragment
- type Func
- type HTML
- type HTMLElement
- type HTMLElements
- type Node
- type Type
- type Value
- type Wrapper
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Append ¶
func Append(children ...interface{})
Append adds children to default body of document.
Types ¶
type Event ¶
type Event interface {
Wrapper
// Type returns event type.
Type() string
// Target returns who issues the event.
Target() EventTarget
// PreventDefault stops default behaviors.
PreventDefault()
}
Event represents javascript event.
type EventTarget ¶
type EventTarget interface {
Wrapper
// AddEventListener adds callback for event.
AddEventListener(event string, cb Func)
// Release frees all callbacks.
Release()
}
EventTarget represents javascript event target.
func EventTargetOf ¶
func EventTargetOf(v Value) EventTarget
EventTargetOf returns an EventTaget object from js.Value.
type HTMLElement ¶
type HTMLElement interface {
Node
fmt.Stringer
// Tag returns tag name.
Tag() string
// Prop returns value of property p.
Prop(p string) Value
// SetProp sets property p with value v.
SetProp(p string, x interface{}) HTMLElement
// Attr returns value of attribute a.
Attr(a string) string
// SetAttr sets attribute a with value v.
SetAttr(args string, v string) HTMLElement
// RemoveAttr removes attribute a.
RemoveAttr(a string) HTMLElement
// Text returns inner text.
Text() string
// SetText sets inner text.
SetText(content string) HTMLElement
// HTML returns innner html.
HTML() HTML
// SetHTML sets inner html.
SetHTML(content HTML) HTMLElement
// Add adds class to class list.
Add(names ...string) HTMLElement
// Remove removes class from class list.
Remove(names ...string) HTMLElement
// Toggle toggle some class.
Toggle(name string) HTMLElement
// Replace replaces old class with new one.
Replace(old, new string) HTMLElement
// Contains returns true if it has the class n, or returns false.
Contains(n string) bool
// Val returns value of input, select and textarea element.
Val() string
// SetVal set value of input, select and textarea element.
SetVal(val string) HTMLElement
// Free deposes the element from dom tree.
Free()
// On adds a callback for event.
On(event string, cb func(HTMLElement, Event)) HTMLElement
}
HTMLElement represents DOM HTMLElement.
func CreateElement ¶
func CreateElement(tag string) HTMLElement
CreateElement returns a html element with html tag.
func HTMLElementOf ¶
func HTMLElementOf(v Value) HTMLElement
func Query ¶
func Query(selectors string) HTMLElement
type HTMLElements ¶
type HTMLElements []HTMLElement
func QueryAll ¶
func QueryAll(selectors string) HTMLElements
func (HTMLElements) Foreach ¶
func (elems HTMLElements) Foreach(fn func(int, HTMLElement))
type Node ¶
type Node interface {
EventTarget
Query(selectors string) HTMLElement
QueryAll(selectors string) HTMLElements
Append(children ...interface{}) Node
Prepend(children ...interface{}) Node
ReplaceChildren(children ...interface{}) Node
Empty() Node
Call(m string, args ...interface{}) Value
}
Click to show internal directories.
Click to hide internal directories.