Documentation ¶
Index ¶
- Constants
- func WrapId(ui UIComposer, id string) (*Element, UIComposer)
- type DOC_READYSTATE
- type DOC_VISIBILITYSTATE
- type Document
- func (_doc *Document) AddEventResize(_listener func(*event.UIEvent, *Document))
- func (_doc *Document) AddEventWheel(_listener func(*event.WheelEvent, *Document))
- func (_doc *Document) AddFocusEvent(_evttyp event.FOCUS_EVENT, _listener func(*event.FocusEvent, *Document))
- func (_doc *Document) AddFullscreenEvent(_evttyp event.FULLSCREEN_EVENT, _listener func(*event.Event, *Document))
- func (_doc *Document) AddGenericEvent(_evttyp event.GENERIC_EVENT, _listener func(*event.Event, *Document))
- func (_doc *Document) AddInputEvent(_evttyp event.INPUT_EVENT, _listener func(*event.InputEvent, *Document))
- func (_doc *Document) AddKeyboardEvent(_evttyp event.KEYBOARD_EVENT, _listener func(*event.KeyboardEvent, *Document))
- func (_doc *Document) AddMouseEvent(_evttyp event.MOUSE_EVENT, _listener func(*event.MouseEvent, *Document))
- func (_doc *Document) AddPointerEvent(_evttyp event.POINTER_EVENT, _listener func(*event.PointerEvent, *Document))
- func (_doc *Document) AppendNodes(nodes []*Node)
- func (_doc *Document) AppendStrings(strs []string)
- func (_doc Document) Body() *Element
- func (_doc Document) CharacterSet() string
- func (_doc Document) ChildAtPoint(x float64, y float64) *Element
- func (doc Document) ChildById(elementId string) *Element
- func (_doc Document) ChildrenAtPoint(x float64, y float64) (_result []*Element)
- func (_doc Document) ChildrenByClassName(classNames string) []*Element
- func (_doc Document) ChildrenByName(elementName string) []*Element
- func (_doc Document) ChildrenByTagName(qualifiedName string) []*Element
- func (_doc Document) ChildrenCount() int
- func (_doc Document) CompatMode() string
- func (_doc Document) ContentType() string
- func (_doc Document) Cookie() string
- func (_doc Document) DesignMode() string
- func (_doc Document) DocTypeName() string
- func (_doc Document) DocTypePublicId() string
- func (_doc Document) DocTypeSystemId() string
- func (_doc Document) FocusedElement() *Element
- func (_doc Document) FullscreenElement() *Element
- func (_doc Document) HasFocus() bool
- func (_doc Document) Head() *Element
- func (_doc Document) Hidden() bool
- func (doc Document) IsInDOM(elemid string) bool
- func (_doc Document) LastModified() time.Time
- func (_doc *Document) PrepenStrings(strs []string)
- func (_doc *Document) PrependNodes(nodes []*Node)
- func (_doc Document) ReadyState() DOC_READYSTATE
- func (_doc Document) Referrer() *url.URL
- func (_doc Document) RootElement() *Element
- func (_doc Document) SelectorQueryAll(selectors string) []*Element
- func (_doc Document) SelectorQueryFirst(selectors string) *Element
- func (_doc *Document) SetBody(value *Element) *Document
- func (_doc *Document) SetCookie(value string) *Document
- func (_doc *Document) SetDesignMode(value string) *Document
- func (_doc *Document) SetTitle(value string) *Document
- func (_doc Document) Title() string
- func (_doc Document) VisibilityState() DOC_VISIBILITYSTATE
- type Element
- func CastElement(_jsv js.JSValueProvider) *Element
- func CastElements(_jsvp js.JSValueProvider) []*Element
- func CreateElement(tagName string) *Element
- func Id(elementid string) *Element
- func MountId(ui UIComposer, id string) *Element
- func TryCastId(ui UIComposer, id string) (*Element, error)
- func TryMountId(ui UIComposer, id string) (*Element, error)
- func TryWrapId(ui UIComposer, id string) (*Element, error)
- func (elem *Element) AccessKey() string
- func (elem *Element) AddClass(lists ...string) *Element
- func (elem *Element) AddClassIf(condition bool, addlist ...string) *Element
- func (_htmle *Element) AddFocusEvent(_evttyp event.FOCUS_EVENT, listener func(*event.FocusEvent, *Element))
- func (elem *Element) AddFullscreenEvent(_evttyp event.FULLSCREEN_EVENT, _listener func(*event.Event, *Element))
- func (_htmle *Element) AddGenericEvent(_evttyp event.GENERIC_EVENT, _listener func(*event.Event, *Element))
- func (_htmle *Element) AddInputEvent(_evttyp event.INPUT_EVENT, listener func(*event.InputEvent, *Element))
- func (_htmle *Element) AddKeyboard(_evttyp event.KEYBOARD_EVENT, listener func(*event.KeyboardEvent, *Element))
- func (_htmle *Element) AddMouseEvent(_evttyp event.MOUSE_EVENT, listener func(*event.MouseEvent, *Element))
- func (_htmle *Element) AddPointerEvent(_evttyp event.POINTER_EVENT, _listener func(*event.PointerEvent, *Element))
- func (_htmle *Element) AddResizeEvent(_listener func(*event.UIEvent, *Element))
- func (_htmle *Element) AddWheelEvent(_listener func(*event.WheelEvent, *Element))
- func (elem *Element) Attribute(aname string) (string, bool)
- func (elem *Element) AttributeIsTrue(aname string) bool
- func (elem *Element) AttributeString() string
- func (_htmle *Element) Blur() *Element
- func (elem *Element) BoundingClientRect() (_rect Rect)
- func (elem *Element) ChildFirst() *Element
- func (elem *Element) ChildLast() *Element
- func (elem *Element) Children() []*Element
- func (elem *Element) ChildrenByClassName(_classNames string) []*Element
- func (root *Element) ChildrenByData(_data string, _value string) []*Element
- func (elem *Element) ChildrenByTagName(_tagName string) []*Element
- func (elem *Element) ChildrenCount() int
- func (root *Element) ChildrenMatching(_match func(*Element) bool) []*Element
- func (elem *Element) Classes() string
- func (elem *Element) ClientRect() (_rect Rect)
- func (_htmle *Element) Focus() *Element
- func (elem *Element) HasClass(class string) bool
- func (elem *Element) Id() string
- func (elem *Element) InnerHTML() string
- func (_htmle *Element) InnerText() string
- func (_me *Element) InsertElement(_where INSERT_WHERE, elem *Element)
- func (elem *Element) InsertRawHTML(where INSERT_WHERE, unsafeHtml string)
- func (elem *Element) InsertSnippet(where INSERT_WHERE, cmp ickcore.Composer) (errx error)
- func (_me *Element) InsertText(_where INSERT_WHERE, _format string, _value ...any)
- func (e *Element) IsDefined() bool
- func (elem *Element) IsDisabled() bool
- func (elem *Element) Name() string
- func (elem *Element) OuterHTML() string
- func (elem *Element) PickClass(classlist string, picked string) *Element
- func (e *Element) Remove()
- func (elem *Element) RemoveAttribute(aname string) *Element
- func (elem *Element) RemoveClass(lists ...string) *Element
- func (elem *Element) ResetClass() *Element
- func (elem *Element) ScrollIntoView() *Element
- func (elem *Element) ScrollRect() (_rect Rect)
- func (elem *Element) SelectorClosest(_selectors string) *Element
- func (elem *Element) SelectorMatches(_selectors string) bool
- func (elem *Element) SelectorQueryAll(_selectors string) []*Element
- func (elem *Element) SelectorQueryFirst(_selectors string) *Element
- func (_htmle *Element) SetAccessKey(key string) *Element
- func (elem *Element) SetAttribute(key string, value string) *Element
- func (elem *Element) SetAttributeIf(condition bool, aname string, valueiftrue string, valueiffalse ...string) *Element
- func (elem *Element) SetBool(aname string, f bool) *Element
- func (elem *Element) SetClassIf(condition bool, classiftrue string, classiffalse ...string) *Element
- func (elem *Element) SetDisabled(f bool) *Element
- func (elem *Element) SetId(id string) *Element
- func (elem *Element) SetName(name string) *Element
- func (elem *Element) SetStyle(style string) *Element
- func (elem *Element) SetTabIndex(index int) *Element
- func (elem *Element) SiblingNext() *Element
- func (elem *Element) SiblingPrevious() *Element
- func (elem *Element) Style() (style string)
- func (elem *Element) SwitchClasses(remove string, new string) *Element
- func (elem *Element) TabIndex() (idx int)
- func (elem *Element) TagName() string
- func (elem *Element) ToggleAttribute(aname string) *Element
- type INSERT_WHERE
- type NODE_POSITION
- type NODE_TYPE
- type Node
- func (_parentnode *Node) AppendChild(newnode *Node) *Node
- func (_node *Node) BaseURI() *url.URL
- func (_node *Node) ChildFirst() *Node
- func (_node *Node) ChildLast() *Node
- func (_node *Node) Children() []*Node
- func (_root *Node) ChildrenMatching(_filter NODE_TYPE, _match func(*Node) bool) []*Node
- func (_onenode *Node) ComparePosition(_other *Node) NODE_POSITION
- func (_node *Node) HasChildren() bool
- func (_parentnode *Node) InsertBefore(newnode *Node, refnode *Node) *Node
- func (_node *Node) IsDefined() bool
- func (n Node) IsInDOM() bool
- func (_node *Node) IsSameNode(_otherNode *Node) bool
- func (_node *Node) NodeName() string
- func (_node *Node) NodeType() NODE_TYPE
- func (_node *Node) NodeValue() string
- func (_node Node) ParentElement() *Element
- func (_node Node) ParentNode() *Node
- func (_parentnode *Node) RemoveChild(_child *Node) *Node
- func (n *Node) RemoveListeners()
- func (_parentnode *Node) ReplaceChild(_newchild *Node, _oldchild *Node) *Node
- func (_node Node) RootNode() *Node
- func (_node *Node) SetNodeValue(value string) *Node
- func (_node *Node) SetTextContent(value string) *Node
- func (_node *Node) SiblingNext() *Node
- func (_node *Node) SiblingPrevious() *Node
- func (_node *Node) TextContent() string
- type Rect
- type UI
- type UIComposer
Constants ¶
const ( UNDEFINED_NODE string = "<undefined node>" UNDEFINED_ATTR string = "<undefined attribute>" )
Variables ¶
This section is empty.
Functions ¶
func WrapId ¶
func WrapId(ui UIComposer, id string) (*Element, UIComposer)
WrapId looks for elemid into the DOM and wrap it to ui if its type corresponds to the attribute name of the element. Returns ui to allow chaining calls.
If elemid is not in the DOM or if the type does not match or if ui does not implement, a message is logged out if verbose mode is on.
Types ¶
type DOC_READYSTATE ¶
type DOC_READYSTATE string
https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState
const ( DOC_READY DOC_READYSTATE = "loading" DOC_INTERACTIVE DOC_READYSTATE = "interactive" DOC_COMPLETE DOC_READYSTATE = "complete" )
type DOC_VISIBILITYSTATE ¶
type DOC_VISIBILITYSTATE string
The Document.visibilityState returns the visibility of the document, that is in which context this element is now visible. It is useful to know if the document is in the background or an invisible tab, or only loaded for pre-rendering.
https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState
const ( DOC_HIDDEN DOC_VISIBILITYSTATE = "hidden" DOC_VISIBLE DOC_VISIBILITYSTATE = "visible" DOC_PRERENDER DOC_VISIBILITYSTATE = "prerender" )
type Document ¶
type Document struct {
Node
}
Document 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 Document 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 CastDocument ¶
func CastDocument(_jsv js.JSValueProvider) *Document
CastDocument is casting a js.Value into Document.
func (*Document) AddEventResize ¶
AddResize is adding doing AddEventListener for 'Resize' on target. This method is returning allocated javascript function that need to be released.
func (*Document) AddEventWheel ¶
func (_doc *Document) AddEventWheel(_listener func(*event.WheelEvent, *Document))
AddWheel is adding doing AddEventListener for 'Wheel' on target. This method is returning allocated javascript function that need to be released.
func (*Document) AddFocusEvent ¶
func (_doc *Document) AddFocusEvent(_evttyp event.FOCUS_EVENT, _listener func(*event.FocusEvent, *Document))
func (*Document) AddFullscreenEvent ¶
func (_doc *Document) AddFullscreenEvent(_evttyp event.FULLSCREEN_EVENT, _listener func(*event.Event, *Document))
AddFullscreenChange is adding doing AddEventListener for 'FullscreenChange' on target. This method is returning allocated javascript function that need to be released.
func (*Document) AddGenericEvent ¶
func (*Document) AddInputEvent ¶
func (_doc *Document) AddInputEvent(_evttyp event.INPUT_EVENT, _listener func(*event.InputEvent, *Document))
func (*Document) AddKeyboardEvent ¶
func (_doc *Document) AddKeyboardEvent(_evttyp event.KEYBOARD_EVENT, _listener func(*event.KeyboardEvent, *Document))
func (*Document) AddMouseEvent ¶
func (_doc *Document) AddMouseEvent(_evttyp event.MOUSE_EVENT, _listener func(*event.MouseEvent, *Document))
func (*Document) AddPointerEvent ¶
func (_doc *Document) AddPointerEvent(_evttyp event.POINTER_EVENT, _listener func(*event.PointerEvent, *Document))
func (*Document) AppendNodes ¶
Append inserts a set of Node objects or string objects after the last child of the document. String objects are inserted as equivalent Text nodes.
https://developer.mozilla.org/en-US/docs/Web/API/Document/append
func (*Document) AppendStrings ¶
Append inserts a set of Node objects or string objects after the last child of the document. String objects are inserted as equivalent Text nodes.
https://developer.mozilla.org/en-US/docs/Web/API/Document/append
func (Document) Body ¶
The Document.body property represents the <body> or <frameset> node of the current document, or null if no such element exists.
https://developer.mozilla.org/en-US/docs/Web/API/Document/body
func (Document) CharacterSet ¶
CharacterSet returns the character encoding of the document that it's currently rendered with.
https://developer.mozilla.org/en-US/docs/Web/API/Document/characterSet
func (Document) ChildAtPoint ¶
GetElementAtPoint returns the topmost Element at the specified coordinates (relative to the viewport).
https://developer.mozilla.org/en-US/docs/Web/API/Document/elementFromPoint
func (Document) ChildById ¶
ChildById calls GetElementById and 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 the id is not found, returns an undefined element, not nil
https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById
func (Document) ChildrenAtPoint ¶
GetElementsAtPoint eturns an array of all elements at the specified coordinates (relative to the viewport). The elements are ordered from the topmost to the bottommost box of the viewport.
https://developer.mozilla.org/en-US/docs/Web/API/Document/elementsFromPoint
func (Document) ChildrenByClassName ¶
GetElementsByClassName returns an array-like object of all child elements which have all of the given class name(s).
https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
func (Document) ChildrenByName ¶
GetElementsByName returns a NodeList Collection of elements with a given name attribute in the document.
https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName
func (Document) ChildrenByTagName ¶
GetElementsByTagName returns an HTMLCollection of elements with the given tag name.
https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByTagName
func (Document) ChildrenCount ¶
ChildElementCount returns the number of child elements of the document.
https://developer.mozilla.org/en-US/docs/Web/API/Document/childElementCount
func (Document) CompatMode ¶
CompatMode ndicates whether the document is rendered in Quirks mode or Standards mode.
https://developer.mozilla.org/en-US/docs/Web/API/Document/compatMode
func (Document) ContentType ¶
ContentType returns the MIME type that the document is being rendered as. This may come from HTTP headers or other sources of MIME information, and might be affected by automatic type conversions performed by either the browser or extensions.
https://developer.mozilla.org/en-US/docs/Web/API/Document/contentType
func (Document) Cookie ¶
Cookie lets you read and write cookies associated with the document. It serves as a getter and setter for the actual values of the cookies.
https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie
func (Document) DesignMode ¶
DesignMode controls whether the entire document is editable. Valid values are "on" and "off". According to the specification, this property is meant to default to "off". Firefox follows this standard. The earlier versions of Chrome and IE default to "inherit". Starting in Chrome 43, the default is "off" and "inherit" is no longer supported. In IE6-10, the value is capitalized.
https://developer.mozilla.org/en-US/docs/Web/API/Document/designMode
func (Document) DocTypeName ¶
Doctype Name, The type of the document. It is always "html" for HTML documents, but will vary for XML documents.
https://developer.mozilla.org/en-US/docs/Web/API/Document/doctype
func (Document) DocTypePublicId ¶
A string with an identifier of the type of document. Always empty ("") for HTML, it will be, for example, "-//W3C//DTD SVG 1.1//EN" for SVG documents.
https://developer.mozilla.org/en-US/docs/Web/API/Document/doctype
func (Document) DocTypeSystemId ¶
A string containing the URL to the associated DTD. Always empty ("") for HTML, it will be, for example, "http://www.w3.org/2000/svg" for SVG documents.
https://developer.mozilla.org/en-US/docs/Web/API/Document/doctype
func (Document) FocusedElement ¶
ActiveElement returns the Element within the DOM that currently has focus.
https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement
func (Document) FullscreenElement ¶
FullscreenElement returns the Element that is currently being presented in fullscreen mode in this document, or null if fullscreen mode is not currently in use.
https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenElement
func (Document) HasFocus ¶
HasFocus returns a boolean value indicating whether the document or any element inside the document has focus. This method can be used to determine whether the active element in a document has focus.
https://developer.mozilla.org/en-US/docs/Web/API/Document/hasFocus
func (Document) Head ¶
Head returns the <head> element of the current document.
https://developer.mozilla.org/en-US/docs/Web/API/Document/head
func (Document) Hidden ¶
Hidden returns a Boolean value indicating if the page is considered hidden or not.
https://developer.mozilla.org/en-US/docs/Web/API/Document/hidden
func (Document) LastModified ¶
LastModified returns a string containing the date and time on which the current document was last modified.
TODO: dom - test Document.LastModified
https://developer.mozilla.org/en-US/docs/Web/API/Document/lastModified
func (*Document) PrepenStrings ¶
Prepend inserts a set of Node objects or string objects before the first child of the document. String objects are inserted as equivalent Text nodes.
https://developer.mozilla.org/en-US/docs/Web/API/Document/prepend
func (*Document) PrependNodes ¶
Prepend inserts a set of Node objects or string objects before the first child of the document. String objects are inserted as equivalent Text nodes.
https://developer.mozilla.org/en-US/docs/Web/API/Document/prepend
func (Document) ReadyState ¶
func (_doc Document) ReadyState() DOC_READYSTATE
ReadyState describes the loading state of the document. When the value of this property changes, a readystatechange event fires on the document object.
https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState
func (Document) Referrer ¶
Referrer returns the URI of the page that linked to this page.
https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer
func (Document) RootElement ¶
DocumentElement returns the Element that is the root element of the document (for example, the <html> element for HTML documents).
https://developer.mozilla.org/en-US/docs/Web/API/Document/documentElement
func (Document) SelectorQueryAll ¶
querySelectorAll returns a static (not live) NodeList representing a list of the document's elements that match the specified group of selectors.
https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll
func (Document) SelectorQueryFirst ¶
QuerySelector returns the first Element within the document that matches the specified selector, or group of selectors. If no matches are found, null is returned.
https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
func (*Document) SetBody ¶
The Document.body property represents the <body> or <frameset> node of the current document, or null if no such element exists.
https://developer.mozilla.org/en-US/docs/Web/API/Document/body
func (*Document) SetCookie ¶
Cookie lets you read and write cookies associated with the document. It serves as a getter and setter for the actual values of the cookies.
https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie
func (*Document) SetDesignMode ¶
DesignMode controls whether the entire document is editable. Valid values are "on" and "off". According to the specification, this property is meant to default to "off". Firefox follows this standard. The earlier versions of Chrome and IE default to "inherit". Starting in Chrome 43, the default is "off" and "inherit" is no longer supported. In IE6-10, the value is capitalized.
https://developer.mozilla.org/en-US/docs/Web/API/Document/designMode
func (*Document) SetTitle ¶
Title gets or sets the current title of the document. When present, it defaults to the value of the <title>.
https://developer.mozilla.org/en-US/docs/Web/API/Document/title
func (Document) Title ¶
Title gets or sets the current title of the document. When present, it defaults to the value of the <title>.
https://developer.mozilla.org/en-US/docs/Web/API/Document/title
func (Document) VisibilityState ¶
func (_doc Document) VisibilityState() DOC_VISIBILITYSTATE
VisibilityState returns the visibility of the document, that is in which context this element is now visible. It is useful to know if the document is in the background or an invisible tab, or only loaded for pre-rendering.
https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState
type Element ¶
type Element struct {
Node
}
Element is the most general base class from which all element objects (i.e. objects that represent elements) in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element.
https://developer.mozilla.org/en-US/docs/Web/API/Element
func CastElement ¶
func CastElement(_jsv js.JSValueProvider) *Element
CastElement is casting a js.Value into Element.
func CastElements ¶
func CastElements(_jsvp js.JSValueProvider) []*Element
func CreateElement ¶
CreateElement creates the HTML element specified by tagName, or an HTMLUnknownElement if tagName isn't recognized.
https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement
func Id ¶
Id returns the Element found in the doc with the _elementId attribute. Returns an undefined Element if the id is not found, never nil.
func MountId ¶
func MountId(ui UIComposer, id string) *Element
MountId wraps the id to the uicomposer and add its listeners and to it and to all its childs. Returns wrapped element
func TryMountId ¶
func TryMountId(ui UIComposer, id string) (*Element, error)
TryMountId wraps the elemid to the uicomposer and add its listeners and to it and to all its childs. Returns wrapping errors.
func TryWrapId ¶
func TryWrapId(ui UIComposer, id string) (*Element, error)
TryWrapId looks for elemid into the DOM and wrap it to ui if its type corresponds to the attribute name of the element. Returns an error if elemid is not in the DOM or if the type does not match or ui ick does not implement .
func (*Element) AccessKey ¶
AccessKey A string indicating the single-character keyboard key to give access to the button.
func (*Element) AddClass ¶
AddClass adds each class in lists strings to the class attribute. Each lists class string can be either a single class or a string of multiple classes separated by spaces. Duplicates are not inserted twice.
func (*Element) AddClassIf ¶
AddClassIf adds each c classe to the class attribute if the condition is true. Does nothing if the condition is false. See SetClassIf to also remove the class if the condition is false.
func (*Element) AddFocusEvent ¶
func (_htmle *Element) AddFocusEvent(_evttyp event.FOCUS_EVENT, listener func(*event.FocusEvent, *Element))
AddBlur is adding doing AddEventListener for 'Blur' on target. This method is returning allocated javascript function that need to be released.
func (*Element) AddFullscreenEvent ¶
func (elem *Element) AddFullscreenEvent(_evttyp event.FULLSCREEN_EVENT, _listener func(*event.Event, *Element))
AddFullscreenChange is adding doing AddEventListener for 'FullscreenChange' on target. This method is returning allocated javascript function that need to be released.
func (*Element) AddGenericEvent ¶
func (_htmle *Element) AddGenericEvent(_evttyp event.GENERIC_EVENT, _listener func(*event.Event, *Element))
AddGenericEvent adds Event Listener for a GENERIC_EVENT on target. Returns the function to call to remove and release the listener
func (*Element) AddInputEvent ¶
func (_htmle *Element) AddInputEvent(_evttyp event.INPUT_EVENT, listener func(*event.InputEvent, *Element))
AddInput is adding doing AddEventListener for 'Input' on target. This method is returning allocated javascript function that need to be released.
func (*Element) AddKeyboard ¶
func (_htmle *Element) AddKeyboard(_evttyp event.KEYBOARD_EVENT, listener func(*event.KeyboardEvent, *Element))
AddKeyDown is adding doing AddEventListener for 'KeyDown' on target. This method is returning allocated javascript function that need to be released.
func (*Element) AddMouseEvent ¶
func (_htmle *Element) AddMouseEvent(_evttyp event.MOUSE_EVENT, listener func(*event.MouseEvent, *Element))
AddClick adds Event Listener for MOUSE_EVENT on target. Returns the function to call to remove and release the listener
func (*Element) AddPointerEvent ¶
func (_htmle *Element) AddPointerEvent(_evttyp event.POINTER_EVENT, _listener func(*event.PointerEvent, *Element))
AddGotPointerCapture is adding doing AddEventListener for 'GotPointerCapture' on target. This method is returning allocated javascript function that need to be released.
func (*Element) AddResizeEvent ¶
AddResize is adding doing AddEventListener for 'Resize' on target. This method is returning allocated javascript function that need to be released.
func (*Element) AddWheelEvent ¶
func (_htmle *Element) AddWheelEvent(_listener func(*event.WheelEvent, *Element))
The wheel event fires when the user rotates a wheel button on a pointing device (typically a mouse).
https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event
func (*Element) Attribute ¶
Attribute returns the value of the attribute identified by its name. Returns false if the attribute does not exist.
Blanks at the ends of the name are automatically trimmed. Attribute's name are case sensitive
func (*Element) AttributeIsTrue ¶
AttributeIsTrue returns true if the attribute exists and if it's value is not false nor 0.
Blanks at the ends of the name are automatically trimmed. Attribute's name are case sensitive.
func (*Element) AttributeString ¶
AttributeString returns the formated list of attributes, ready to use to generate the tag element.
func (*Element) Blur ¶
Blur removes keyboard focus from the current element.
https://developer.mozilla.org/en-US/docs/Web/API/Element/blur
func (*Element) BoundingClientRect ¶
GetBoundingClientRect eturns a DOMRect object providing information about the size of an element and its position relative to the viewport.
https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect
func (*Element) ChildFirst ¶
FirstElementChild returns an element's first child Element, or null if there are no child elements.
https://developer.mozilla.org/en-US/docs/Web/API/Element/firstElementChild
func (*Element) ChildLast ¶
LastElementChild returns an element's last child Element, or null if there are no child elements.
https://developer.mozilla.org/en-US/docs/Web/API/Element/lastElementChild
func (*Element) Children ¶
Children returns a live HTMLCollection which contains all of the child elements of the element upon which it was called.
Includes only element nodes. To get all child nodes, including non-element nodes like text and comment nodes, use Node.Children
https://developer.mozilla.org/en-US/docs/Web/API/Element/children
func (*Element) ChildrenByClassName ¶
GetElementsByClassName returns a live HTMLCollection which contains every descendant element which has the specified class name or names.
https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName
func (*Element) ChildrenByData ¶
ChildrenMatching make a slice of Element, scaning recursively every children of this Element. Only nodes having data attribites matching _data like "data-myvalue"
func (*Element) ChildrenByTagName ¶
GetElementsByTagName returns a live HTMLCollection of elements with the given tag name.
https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName
func (*Element) ChildrenCount ¶
ChildElementCount returns the number of child elements of this element. https://developer.mozilla.org/en-US/docs/Web/API/Element/childElementCount
func (*Element) ChildrenMatching ¶
ChildrenMatching make a slice of Element, scaning recursively every children of this Element. Only nodes matching the optional _match function are included.
func (*Element) Classes ¶
Classes returns the class object related to elem. If elem is defined, the class object is wrapped with the DOMTokenList collection of the class attribute of elem.
https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
func (*Element) ClientRect ¶
ClientRect returns border coordinates of an element in pixels.
Note: This property will round the value to an integer. If you need a fractional value, use element.jsValue.getBoundingClientRect().
func (*Element) Focus ¶
Focus sets focus on the specified element, if it can be focused. The focused element is the element that will receive keyboard and similar events by default.
By default the browser will scroll the element into view after focusing it, and it may also provide visible indication of the focused element (typically by displaying a "focus ring" around the element).
https://developer.mozilla.org/en-US/docs/Web/API/Element/focus
func (*Element) Id ¶
Id rrepresents the element's identifier, reflecting the id global attribute. Returns the UNDEFINED_NODE string if elem is nil or not a defined js value. Returns the UNDEFINED_ATTR string if the returned string is empty.
func (*Element) InnerHTML ¶
AttributeString r InnerHTML gets or sets the HTML or XML markup contained within the element.
To insert the HTML into the document rather than replace the contents of an element, use the method insertAdjacentHTML().
https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML
func (*Element) InnerText ¶
InnerText represents the rendered text content of a node and its descendants.
InnerText gets pure text, removing any html or css, while TextContent keeps the representation.
https://developer.mozilla.org/en-US/docs/Web/API/Element/innerText
func (*Element) InsertElement ¶
func (_me *Element) InsertElement(_where INSERT_WHERE, elem *Element)
func (*Element) InsertRawHTML ¶
func (elem *Element) InsertRawHTML(where INSERT_WHERE, unsafeHtml string)
TODO: dom - handle Element.InsertRawHTML exceptions
func (*Element) InsertSnippet ¶
func (elem *Element) InsertSnippet(where INSERT_WHERE, cmp ickcore.Composer) (errx error)
InsertSnippet unfolds and renders the html of the composer and write it into the DOM. The composer and all its embedded components are wrapped with their DOM element and their listeners are added to the DOM. Composer can be either a simple html ElementComposer or an UIComposer.
Returns an error if elem in not in the DOM or the _snippet has an Id and it's already in the DOM. Returns an error if WriteSnippet or mounting process fail.
func (*Element) InsertText ¶
func (_me *Element) InsertText(_where INSERT_WHERE, _format string, _value ...any)
InsertText insert the formated _value as a simple text (not an HTML string) at the _where position. The format string follow the fmt rules: https://pkg.go.dev/fmt#hdr-Printing
func (*Element) IsDefined ¶
IsDefined returns true if the Element is not nil AND it's type is not TypeNull and not TypeUndefined
func (*Element) IsDisabled ¶
Style returns the style attribute
func (*Element) Name ¶
Name returns the value of the name attribute. Returns the UNDEFINED_NODE string if elem is nil or not a defined js value. Returns the UNDEFINED_ATTR string if the returned string is empty.
func (*Element) OuterHTML ¶
OuterHTML gets the serialized HTML fragment describing the element including its descendants. It can also be set to replace the element with nodes parsed from the given string.
To only obtain the HTML representation of the contents of an element, or to replace the contents of an element, use the innerHTML property instead.
https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML
func (*Element) PickClass ¶
PickClass set the picked class and only that one, removing all others in the classlist. If picked is empty or not in the classlist then it's not added.
func (*Element) Remove ¶
func (e *Element) Remove()
Remove removes the element and its listeners from the DOM. Does nothing if e is not defined.
func (*Element) RemoveAttribute ¶
RemoveAttribute removes the attribute identified by its name. Does nothing if the name is not in the map.
Blanks at the ends of the name are automatically trimmed. Attribute's name are case sensitive
func (*Element) RemoveClass ¶
RemoveClass removes each class in lists strings from the class attribute. Each lists class string can be either a single class or a string of multiple classes separated by spaces.
func (*Element) ResetClass ¶
ResetClass removes all classes by removing the class attribute
func (*Element) ScrollIntoView ¶
ScrollIntoView scrolls the element's ancestor containers such that the element on which scrollIntoView() is called is visible to the user.
https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
func (*Element) ScrollRect ¶
ScrollTop gets or sets the number of pixels that an element's content is scrolled vertically.
https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTop https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollWidth
func (*Element) SelectorClosest ¶
Traverses the element and its parents (heading toward the document root) until it finds a node that matches the specified CSS selector.
https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
func (*Element) SelectorMatches ¶
Matches tests whether the element would be selected by the specified CSS selector.
https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
func (*Element) SelectorQueryAll ¶
QuerySelectorAll returns a static (not live) NodeList representing a list of elements matching the specified group of selectors which are descendants of the element on which the method was called.
https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll
func (*Element) SelectorQueryFirst ¶
QuerySelector returns the first element that is a descendant of the element on which it is invoked that matches the specified group of selectors.
https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector
func (*Element) SetAccessKey ¶
AccessKey A string indicating the single-character keyboard key to give access to the button.
func (*Element) SetAttribute ¶
SetAttribute creates an attribute in the map and set its value. If the attribute already exists in the map it is updated.
Blanks at the ends of the name are automatically trimmed. Attribute's name are case sensitive
func (*Element) SetAttributeIf ¶
func (elem *Element) SetAttributeIf(condition bool, aname string, valueiftrue string, valueiffalse ...string) *Element
SetAttributeIf SetAttribute if the condition is true, otherwise remove the attribute.
Blanks at the ends of the name are automatically trimmed. Attribute's name are case sensitive.
func (*Element) SetBool ¶
SetBoolAttribute sets or overwrites a boolean attribute and returns the map to allow chainning.
Blanks at the ends of the name are automatically trimmed. Attribute's name is case sensitive.
func (*Element) SetClassIf ¶
func (elem *Element) SetClassIf(condition bool, classiftrue string, classiffalse ...string) *Element
SetClassIf adds each c classe to the class attribute if the condition is true, otherwise remove them.
func (*Element) SetDisabled ¶
SetDisabled sets the boolean disabled attribute
func (*Element) SetName ¶
SetName sets or overwrites the name attribute. In HTML5 name is case sensitive. blanks at the ends of the id are automatically trimmed. if name is empty, the name attribute is removed.
func (*Element) SetTabIndex ¶
TabIndex represents the tab order of the current element.
Tab order is as follows:
- Elements with a positive tabindex. Elements that have identical tabindex values should be navigated in the order they appear. Navigation proceeds from the lowest tabindex to the highest tabindex.
- Elements that do not support the tabindex attribute or support it and assign tabindex to 0, in the order they appear.
- Elements that are disabled do not participate in the tabbing order.
Values don't need to be sequential, nor must they begin with any particular value. They may even be negative, though each browser trims very large values.
https://developer.mozilla.org/fr/docs/Web/HTML/Global_attributes/tabindex
func (*Element) SiblingNext ¶
NextElementSibling returns the element immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list.
https://developer.mozilla.org/en-US/docs/Web/API/Element/nextElementSibling
func (*Element) SiblingPrevious ¶
PreviousElementSibling returns the Element immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list.
https://developer.mozilla.org/en-US/docs/Web/API/Element/previousElementSibling
func (*Element) SwitchClasses ¶
SwitchClass removes one class and set a new one
func (*Element) TabIndex ¶
TabIndex represents the tab order of the current element.
Tab order is as follows:
- Elements with a positive tabindex. Elements that have identical tabindex values should be navigated in the order they appear. Navigation proceeds from the lowest tabindex to the highest tabindex.
- Elements that do not support the tabindex attribute or support it and assign tabindex to 0, in the order they appear.
- Elements that are disabled do not participate in the tabbing order.
Values don't need to be sequential, nor must they begin with any particular value. They may even be negative, though each browser trims very large values.
https://developer.mozilla.org/fr/docs/Web/HTML/Global_attributes/tabindex
func (*Element) TagName ¶
TagName returns the tag name of the element on which it's called. Always in Uppercase for HTML element.
https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName
func (*Element) ToggleAttribute ¶
ToggleAttribute toggles an attribute like a boolean. If the attribute exists it's removed, if it does not exists it's created without value.
Blanks at the ends of the name are automatically trimmed. Attribute's name are case sensitive
type INSERT_WHERE ¶
type INSERT_WHERE int
const ( INSERT_BEFORE_ME INSERT_WHERE = iota // Before the Element itself. INSERT_FIRST_CHILD // Just inside the element, before its first child. INSERT_LAST_CHILD // Just inside the element, after its last child. INSERT_AFTER_ME // After the element itself. INSERT_OUTER // like outerhtml INSERT_BODY // like inner html )
type NODE_POSITION ¶
type NODE_POSITION int
An integer value representing otherNode's position relative to node as a bitmask.
const ( NODEPOS_UNDEF NODE_POSITION = 0x00 NODEPOS_DISCONNECTED NODE_POSITION = 0x01 NODEPOS_PRECEDING NODE_POSITION = 0x02 NODEPOS_FOLLOWING NODE_POSITION = 0x04 NODEPOS_CONTAINS NODE_POSITION = 0x08 NODEPOS_CONTAINED_BY NODE_POSITION = 0x10 NODEPOS_IMPLEMENTATION_SPECIFIC NODE_POSITION = 0x20 )
type NODE_TYPE ¶
type NODE_TYPE int
const ( NT_ALL NODE_TYPE = 0xFFFF NT_UNDEF NODE_TYPE = 0x0000 NT_ELEMENT NODE_TYPE = 0x0001 // An Element node like <p> or <div>. aka ELEMNT_NODE. NT_ATTRIBUTE NODE_TYPE = 0x0002 // An Attribute of an Element. aka ATTRIBUTE_NODE. NT_TEXT NODE_TYPE = 0x0003 // The actual Text inside an Element or Attr. aka TEXT_NODE. NT_CDATA_SECTION NODE_TYPE = 0x0004 // A CDATASection, such as <!CDATA[[ … ]]>. aka CDATA_SECTION_NODE. NT_PROCESSING_INSTRUCTION NODE_TYPE = 0x0007 // A ProcessingInstruction of an XML document, such as <?xml-stylesheet … ?>. NT_COMMENT NODE_TYPE = 0x0008 // A Comment node, such as <!-- … -->. aka COMMENT_NODE. NT_DOCUMENT NODE_TYPE = 0x0009 // A Document node. aka DOCUMENT_NODE. NT_DOCUMENT_TYPE NODE_TYPE = 0x000A // A DocumentType node, such as <!DOCTYPE html>. aka DOCUMENT_TYPE_NODE. NT_DOCUMENT_FRAGMENT NODE_TYPE = 0x000B // A DocumentFragment node. aka DOCUMENT_FRAGMENT_NODE. NT_ENTITY_REFERENCE NODE_TYPE = 0x0005 // Deprecated NT_ENTITY NODE_TYPE = 0x0006 // Deprecated NT_NOTATION NODE_TYPE = 0x000C // Deprecated )
type Node ¶
https://developer.mozilla.org/en-US/docs/Web/API/Node
func CastNode ¶
func CastNode(_jsvp js.JSValueProvider) *Node
CastNode is casting a js.Value into Node.
func CastNodes ¶
func CastNodes(_jsvp js.JSValueProvider) []*Node
func (*Node) AppendChild ¶
AppenChild 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.
Returns the _parent to enable chaining calls.
https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
func (*Node) BaseURI ¶
BaseURI returns the absolute base URL of the document containing the node.
https://developer.mozilla.org/en-US/docs/Web/API/Node/baseURI
func (*Node) ChildFirst ¶
FirstChild returns the node's first child in the tree, or null if the node has no children.
https://developer.mozilla.org/en-US/docs/Web/API/Node/firstChild
func (*Node) ChildLast ¶
LastChild returns the last child of the node. If its parent is an element, then the child is generally an element node, a text node, or a comment node. It returns null if there are no child nodes.
https://developer.mozilla.org/en-US/docs/Web/API/Node/lastChild
func (*Node) Children ¶
ChildNodes returns a ~live~ static NodeList of child nodes of the given element where the first child node is assigned index 0. Child nodes include elements, text and comments.
https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes
func (*Node) ChildrenMatching ¶
ChildrenMatching make a slice of nodes, scaning recursively every children of this Node. Only nodes matching _filter AND the optional _match function are included.
func (*Node) ComparePosition ¶
func (_onenode *Node) ComparePosition(_other *Node) NODE_POSITION
CompareDocumentPosition reports the position of its argument node relative to the node on which it is called.
https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
func (*Node) HasChildren ¶
HasChildNodes returns a boolean value indicating whether the given Node has child nodes or not.
https://developer.mozilla.org/en-US/docs/Web/API/Node/hasChildNodes
func (*Node) InsertBefore ¶
InsertBefore inserts a newnode before a refnode. if refnode is nil, then newNode is inserted at the end of node's child nodes.
If the given node already exists in the document, insertBefore() moves it from its current position to the new position. (That is, it will automatically be removed from its existing parent before appending it to the specified new parent.)
Returns the _parent to enable chaining calls.
https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore
func (*Node) IsDefined ¶
IsDefined returns true if the Element is not nil AND it's type is not TypeNull and not TypeUndefined
func (Node) IsInDOM ¶
IsInDOM returns a boolean indicating whether the node is within a Document object. Returns false if the node is not defined.
https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected
func (*Node) IsSameNode ¶
IsSameNode tests whether two nodes are the same (in other words, whether they reference the same object). https://developer.mozilla.org/en-US/docs/Web/API/Node/isSameNode
func (*Node) NodeName ¶
Values for the different types of nodes are:
- Attr: the qualified name of the attribute.
- CDATASection: "#cdata-section".
- Comment: "#comment".
- Document: "#document".
- DocumentFragment: "#document-fragment".
- DocumentType: the value of DocumentType.name
- Element: the uppercase name of the element tag if an HTML element, or the lowercase element tag if an XML element (like a SVG or MATHML element).
- ProcessingInstruction: The value of ProcessingInstruction.target
- Text: "#text".
NodeName returns the name of the current node as a string.
func (*Node) NodeType ¶
NodeType It distinguishes different kind of nodes from each other, such as elements, text and comments.
https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
func (*Node) NodeValue ¶
NodeValue is a string containing the value of the current node, if any.
For the document itself, nodeValue returns null. For text, comment, and CDATA nodes, nodeValue returns the content of the node. For attribute nodes, the value of the attribute is returned.
https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue
func (Node) ParentElement ¶
ParentElement returns the DOM node's parent Element, or null if the node either has no parent, or its parent isn't a DOM Element. https://developer.mozilla.org/en-US/docs/Web/API/Node/parentElement
func (Node) ParentNode ¶
ParentNode returns the parent of the specified node in the DOM tree.
https://developer.mozilla.org/en-US/docs/Web/API/Node/parentNode
func (*Node) RemoveChild ¶
RemoveChild removes a child node from the DOM
Returns the _parent to enable chaining calls.
https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild
func (*Node) RemoveListeners ¶
func (n *Node) RemoveListeners()
RemoveListeners removes all event listeners and release ressources allocated fot the associated js func To be called only when event handlers have been added to the node.
func (*Node) ReplaceChild ¶
ReplaceChild replaces a child node within the given (parent) node.
Returns the _parent to enable chaining calls.
https://developer.mozilla.org/en-US/docs/Web/API/Node/replaceChild
func (Node) RootNode ¶
GetRootNode returns the context object's root, which optionally includes the shadow root if it is available.
https://developer.mozilla.org/en-US/docs/Web/API/Node/getRootNode
func (*Node) SetNodeValue ¶
NodeValue is a string containing the value of the current node, if any.
For the document itself, nodeValue returns null. For text, comment, and CDATA nodes, nodeValue returns the content of the node. For attribute nodes, the value of the attribute is returned.
https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue
func (*Node) SetTextContent ¶
TextContent represents the text content of the node and its descendants.
https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent
func (*Node) SiblingNext ¶
NextSibling returns the node immediately following the specified one in their parent's childNodes, or returns null if the specified node is the last child in the parent element.
https://developer.mozilla.org/en-US/docs/Web/API/Node/nextSibling
func (*Node) SiblingPrevious ¶
PreviousSibling returns the node immediately preceding the specified one in its parent's childNodes list, or null if the specified node is the first in that list.
https://developer.mozilla.org/en-US/docs/Web/API/Node/previousSibling
func (*Node) TextContent ¶
TextContent represents the text content of the node and its descendants.
https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent
type UI ¶
type UI struct {
DOM Element
}
UISnippet combines an htmlSnippet allowing html rendering of ick-name tags in different ways, and a wrapped dom.Element allowing event listening and other direct DOM interactions.
func (*UI) AddListeners ¶
func (ui *UI) AddListeners()
AddListeners does nothing by default. Can be implemented by the component embedding UISnippet.
func (*UI) RefreshContent ¶
func (ui *UI) RefreshContent(cmp ickcore.ContentComposer) (errx error)
RefreshContent renders the cmp's content and re-insert it into the DOM. RefreshContent removes and re-add all listeners
func (*UI) RemoveListeners ¶
func (ui *UI) RemoveListeners()
RemoveListeners remove all event handlers attached to this UISnippet Element. If RemoveListeners is implemented by the component embedding UISnippet then the UISnippet one should be called. Usually RemoveListeners does not need to be overloaded because every listeners added to the Element are automatically removed.
func (*UI) Wrap ¶
func (ui *UI) Wrap(jsvp js.JSValueProvider)
Wrap implements the JSValueWrapper to enable wrapping of a dom.Element usually to wrap embedded component instantiated during unfolding an html string. Does not need to be overloaded by the component embedding UISnippet.
type UIComposer ¶
type UIComposer interface { ickcore.TagBuilder ickcore.ContentComposer Wrap(js.JSValueProvider) AddListeners() RemoveListeners() }