Documentation
¶
Index ¶
- func Wrap(elem Element, mods ...Modifier)
- type ChildHolder
- func Button(mods ...Modifier) ChildHolder
- func Circle(mods ...Modifier) ChildHolder
- func Div(mods ...Modifier) ChildHolder
- func Elem(name string, mods ...Modifier) ChildHolder
- func I(mods ...Modifier) ChildHolder
- func Input(mods ...Modifier) ChildHolder
- func P(mods ...Modifier) ChildHolder
- func Span(mods ...Modifier) ChildHolder
- func Svg(mods ...Modifier) ChildHolder
- type Document
- func (n Document) AppendChild(aChild Node) Node
- func (d Document) Body() Element
- func (n Document) Clear()
- func (d Document) CreateElement(name string) Element
- func (d Document) CreateElementNS(ns string, name string) Element
- func (d Document) DocumentElement() Element
- func (d Document) GetElementById(id string) Element
- func (n Document) InnerHTML() string
- func (n Document) InsertBefore(newNode, refNode Node) Node
- func (n Document) NextSibling() Node
- func (n Document) RemoveChild(aChild Node) Node
- func (n Document) SetInnerHTML(v string)
- func (n Document) SetInnerText(v string) absNode
- func (n Document) SetTextContent(v string)
- func (n Document) Style() Style
- func (n Document) TextContent() string
- func (n Document) Unwrap() js.Value
- type Element
- func (s Element) AddClass(v string) Element
- func (t Element) AddEventListener(typ string, listener func(this js.Value, args []js.Value) interface{}, ...) Func
- func (n Element) AppendChild(aChild Node) Node
- func (n Element) Clear()
- func (s Element) FirstChild() Element
- func (s Element) GetAttr(key interface{}) js.Value
- func (s Element) HasClass(v string) bool
- func (s Element) Id() string
- func (n Element) InnerHTML() string
- func (n Element) InsertBefore(newNode, refNode Node) Node
- func (s Element) IsValid() bool
- func (n Element) NextSibling() Node
- func (n Element) RemoveChild(aChild Node) Node
- func (s Element) RemoveClass(v string) Element
- func (s Element) SetAriaHidden(b bool) Element
- func (s Element) SetAriaLabel(l string) Element
- func (s Element) SetAriaOrientation(o string) Element
- func (s Element) SetAttr(key, val interface{}) Element
- func (s Element) SetAttrNS(ns string, key, val string) Element
- func (s Element) SetClassName(str string) Element
- func (s Element) SetDisabled(b bool) Element
- func (s Element) SetFor(id string) Element
- func (s Element) SetHref(v string) Element
- func (s Element) SetId(id string) Element
- func (n Element) SetInnerHTML(v string)
- func (s Element) SetInnerText(str string) Element
- func (s Element) SetRole(r string) Element
- func (s Element) SetScope(r string) Element
- func (s Element) SetTabIndex(i int) Element
- func (s Element) SetText(v string) Element
- func (n Element) SetTextContent(v string)
- func (s Element) SetType(t string) Element
- func (n Element) Style() Style
- func (n Element) TextContent() string
- func (n Element) Unwrap() js.Value
- type EventTarget
- type Func
- type Location
- type Modifier
- func AriaLabelledby(label string) Modifier
- func Class(c ...string) Modifier
- func Cx(v string) Modifier
- func Cy(v string) Modifier
- func Fill(v string) Modifier
- func Id(id string) Modifier
- func R(v string) Modifier
- func Role(r string) Modifier
- func StrokeMiterlimit(v string) Modifier
- func StrokeWidth(v string) Modifier
- func TextContent(r string) Modifier
- func Type(v string) Modifier
- func ViewBox(v string) Modifier
- type Node
- type Style
- func (s Style) Delete(k string)
- func (s Style) Set(k, v string)
- func (s Style) SetBackgroundColor(v string)
- func (s Style) SetColor(v string)
- func (s Style) SetMargin(v string)
- func (s Style) SetMarginBottom(v string)
- func (s Style) SetMarginLeft(v string)
- func (s Style) SetMarginRight(v string)
- func (s Style) SetMarginTop(v string)
- func (s Style) SetPadding(v string)
- func (s Style) SetPaddingBottom(v string)
- func (s Style) SetPaddingLeft(v string)
- func (s Style) SetPaddingRight(v string)
- func (s Style) SetPaddingTop(v string)
- func (s Style) SetProperty(k, v string)
- func (s Style) Unwrap() js.Value
- func (s Style) Update(k, v string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChildHolder ¶
type ChildHolder struct { Element Element // contains filtered or unexported fields }
func Button ¶
func Button(mods ...Modifier) ChildHolder
func Circle ¶
func Circle(mods ...Modifier) ChildHolder
func Div ¶
func Div(mods ...Modifier) ChildHolder
func Elem ¶
func Elem(name string, mods ...Modifier) ChildHolder
func I ¶
func I(mods ...Modifier) ChildHolder
func Input ¶
func Input(mods ...Modifier) ChildHolder
func P ¶
func P(mods ...Modifier) ChildHolder
func Span ¶
func Span(mods ...Modifier) ChildHolder
func Svg ¶
func Svg(mods ...Modifier) ChildHolder
func (ChildHolder) Apply ¶
func (f ChildHolder) Apply(e Element)
func (ChildHolder) Build ¶
func (f ChildHolder) Build(e Element) Element
func (ChildHolder) Self ¶
func (f ChildHolder) Self(e *Element) ChildHolder
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
The Document interface represents any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree. The DOM tree includes elements such as <body> and <table>, among many others. It provides functionality globally to the document, like how to obtain the page's URL and create new elements in the document. The Document interface describes the common properties and methods for any kind of document. Depending on the document's type (e.g. HTML, XML, SVG, …), a larger API is available: HTML documents, served with the "text/html" content type, also implement the HTMLDocument interface, whereas XML and SVG documents implement the XMLDocument interface.
func (Document) AppendChild ¶
The absNode.appendChild() method adds a node to the end of the list of children of a specified parent node. If the given child is a reference to an existing node in the document, appendChild() moves it from its current position to the new position (there is no requirement to remove the node from its parent node before appending it to some other node).
This means that a node can't be in two points of the document simultaneously. So if the node already has a parent, the node is first removed, then appended at the new position. The absNode.cloneNode() method can be used to make a copy of the node before appending it under the new parent. Note that the copies made with cloneNode will not be automatically kept in sync.
If the given child is a DocumentFragment, the entire contents of the DocumentFragment are moved into the child list of the specified parent node.
func (Document) CreateElement ¶
In an HTML document, the document.createElement() method creates the HTML element specified by tagName, or an HTMLUnknownElement if tagName isn't recognized.
func (Document) CreateElementNS ¶
In an HTML document, the document.createElement() method creates the HTML element specified by tagName, or an HTMLUnknownElement if tagName isn't recognized.
func (Document) DocumentElement ¶
func (Document) GetElementById ¶
The Document method getElementById() returns an Element object representing the element whose id property matches the specified string. Since element IDs are required to be unique if specified, they're a useful way to get access to a specific element quickly.
If you need to get access to an element which doesn't have an ID, you can use querySelector() to find the element using any selector.
func (Document) InnerHTML ¶
func (n Document) InnerHTML() string
The Element property innerHTML gets or sets the HTML or XML markup contained within the element.
Note: If a <div>, <span>, or <noembed> node has a child text node that includes the characters (&), (<), or (>), innerHTML returns these characters as the HTML entities "&", "<" and ">" respectively. Use Node.textContent to get a raw copy of these text nodes' contents. To insert the HTML into the document rather than replace the contents of an element, use the method insertAdjacentHTML().
func (Document) InsertBefore ¶
func (Document) NextSibling ¶
func (n Document) NextSibling() Node
func (Document) RemoveChild ¶
func (Document) SetInnerHTML ¶
func (n Document) SetInnerHTML(v string)
The Element property innerHTML gets or sets the HTML or XML markup contained within the element.
Note: If a <div>, <span>, or <noembed> node has a child text node that includes the characters (&), (<), or (>), innerHTML returns these characters as the HTML entities "&", "<" and ">" respectively. Use Node.textContent to get a raw copy of these text nodes' contents. To insert the HTML into the document rather than replace the contents of an element, use the method insertAdjacentHTML().
func (Document) SetInnerText ¶
func (n Document) SetInnerText(v string) absNode
func (Document) SetTextContent ¶
func (n Document) SetTextContent(v string)
The SetTextContent property of the absNode interface represents the text content of the node and its descendants.
func (Document) TextContent ¶
func (n Document) TextContent() string
The TextContent property of the absNode interface represents the text content of the node and its descendants.
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
Element is the most general base class from which all objects in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element. For example, the HTMLElement interface is the base interface for HTML elements, while the SVGElement interface is the basis for all SVG elements. Most functionality is specified further down the class hierarchy.&
Languages outside the realm of the Web platform, like XUL through the XULElement interface, also implement Element.
func NewElement ¶
func (Element) AddEventListener ¶
func (Element) AppendChild ¶
The absNode.appendChild() method adds a node to the end of the list of children of a specified parent node. If the given child is a reference to an existing node in the document, appendChild() moves it from its current position to the new position (there is no requirement to remove the node from its parent node before appending it to some other node).
This means that a node can't be in two points of the document simultaneously. So if the node already has a parent, the node is first removed, then appended at the new position. The absNode.cloneNode() method can be used to make a copy of the node before appending it under the new parent. Note that the copies made with cloneNode will not be automatically kept in sync.
If the given child is a DocumentFragment, the entire contents of the DocumentFragment are moved into the child list of the specified parent node.
func (Element) FirstChild ¶
func (Element) InnerHTML ¶
func (n Element) InnerHTML() string
The Element property innerHTML gets or sets the HTML or XML markup contained within the element.
Note: If a <div>, <span>, or <noembed> node has a child text node that includes the characters (&), (<), or (>), innerHTML returns these characters as the HTML entities "&", "<" and ">" respectively. Use Node.textContent to get a raw copy of these text nodes' contents. To insert the HTML into the document rather than replace the contents of an element, use the method insertAdjacentHTML().
func (Element) InsertBefore ¶
func (Element) NextSibling ¶
func (n Element) NextSibling() Node
func (Element) RemoveChild ¶
func (Element) RemoveClass ¶
func (Element) SetAriaHidden ¶
func (Element) SetAriaLabel ¶
func (Element) SetAriaOrientation ¶
func (Element) SetClassName ¶
func (Element) SetDisabled ¶
func (Element) SetInnerHTML ¶
func (n Element) SetInnerHTML(v string)
The Element property innerHTML gets or sets the HTML or XML markup contained within the element.
Note: If a <div>, <span>, or <noembed> node has a child text node that includes the characters (&), (<), or (>), innerHTML returns these characters as the HTML entities "&", "<" and ">" respectively. Use Node.textContent to get a raw copy of these text nodes' contents. To insert the HTML into the document rather than replace the contents of an element, use the method insertAdjacentHTML().
func (Element) SetInnerText ¶
func (Element) SetTabIndex ¶
func (Element) SetTextContent ¶
func (n Element) SetTextContent(v string)
The SetTextContent property of the absNode interface represents the text content of the node and its descendants.
func (Element) TextContent ¶
func (n Element) TextContent() string
The TextContent property of the absNode interface represents the text content of the node and its descendants.
type EventTarget ¶
type EventTarget interface { // The EventTarget method addEventListener() sets up a function that will be called whenever the specified event is delivered to the target. Common targets are Element, Document, and Window, but the target may be any object that supports events (such as XMLHttpRequest). // //addEventListener() works by adding a function or an object that implements EventListener to the list of event listeners for the specified event type on the EventTarget on which it's called. AddEventListener(typ string, listener func()) }
EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.
Element, Document, and Window are the most common event targets, but other objects can be event targets too, for example XMLHttpRequest, AudioNode, AudioContext, and others.
Many event targets (including elements, documents, and windows) also support setting event handlers via onevent properties and attributes.
type Location ¶
type Location struct {
// contains filtered or unexported fields
}
The Location interface represents the location (URL) of the object it is linked to. Changes done on it are reflected on the object it relates to. Both the Document and Window interface have such a linked Location, accessible via Document.location and Window.location respectively.
type Modifier ¶
type Modifier interface {
Apply(e Element)
}
func AriaLabelledby ¶
func StrokeMiterlimit ¶
func StrokeWidth ¶
func TextContent ¶
type Node ¶
type Node interface { TextContent() string SetTextContent(v string) AppendChild(aChild Node) Node Unwrap() js.Value }
Node is an interface from which various types of DOM API objects inherit. This allows these types to be treated similarly; for example, inheriting the same set of methods or being tested in the same way.
All of the following interfaces inherit the absNode interface's methods and properties: Document, Element, Attr, CharacterData (which Text, Comment, and CDATASection inherit), ProcessingInstruction, DocumentFragment, DocumentType, Notation, Entity, EntityReference
These interfaces may return null in certain cases where the methods and properties are not relevant. They may throw an exception — for example when adding children to a node type for which no children can exist.
type Style ¶
type Style struct {
// contains filtered or unexported fields
}