glize/dom

Methods

(static) addEvent(element, type, listener)

Alias of W3C element.addEventListener. Used to reduce size after code compilation.
Source:
Parameters:
Name Type Description
element Element | Node | Window Element to which attach event.
type string Type of event.
listener function Event listener.

(static) appendNode(parent, child) → (non-null) {Node}

Alias of W3C element.appendChild. Used to reduce size after code compilation.
Source:
Parameters:
Name Type Description
parent Node | Element The parent element.
child Node | Element The child element.
Returns:
Type:
Node
Returns a reference to the child that is appended to the parent.

(static) deleteNode(elementnullable)

Removes the object from the document hierarchy.
Source:
See:
Parameters:
Name Type Attributes Description
element Node <nullable>
The element to remove.

(static) getCharset() → {string}

Gets default document charset.
Source:
Returns:
Type:
string
Returns default document charset.

(static) getDocument() → (nullable) {HTMLDocument}

Gets HTML document object.
Source:
See:
Returns:
Type:
HTMLDocument
Returns HTML document object.

(static) getElement(id) → (nullable) {Element}

Alias of W3C document.getElementById. Used to reduce size after code compilation.
Source:
Parameters:
Name Type Description
id string A case-sensitive string representing the unique ID of the element being sought.
Returns:
Type:
Element
Returns reference to an Element object, or null if an element with the specified ID is not in the document.

(static) getElementBySelectors(element, selectors) → (nullable) {Element}

Alias of W3C element.querySelector. Used to reduce size after code compilation.
Source:
See:
Parameters:
Name Type Description
element Element | DocumentFragment Element to start searching.
selectors string One or more CSS selectors separated by commas.
Returns:
Type:
Element
Returns the first element that is a descendant of the element on which it is invoked that matches the specified group of selectors.

(static) getElementsByClass(element, className) → (nullable) {NodeList}

Alias of W3C element.getElementsByClassName. Used to reduce size after code compilation.
Source:
Parameters:
Name Type Description
element Element | Node Element to start searching.
className string Class name to match.
Returns:
Type:
NodeList
Array of found elements.

(static) getElementsBySelectors(element, selectors) → (nullable) {NodeList}

Alias of W3C element.querySelectorAll. Used to reduce size after code compilation.
Source:
See:
Parameters:
Name Type Description
element Element | DocumentFragment Element to start searching.
selectors string One or more CSS selectors separated by commas.
Returns:
Type:
NodeList
Returns a list of the elements within the document that match the specified group of selectors.

(static) getElementsByTag(element, tagName) → (nullable) {NodeList}

Alias of W3C element.getElementsByTagName. Used to reduce size after code compilation.
Source:
Parameters:
Name Type Description
element Element | Node Element to search tags.
tagName string Tag name.
Returns:
Type:
NodeList
Returns list of found elements in the order they appear in the tree.

(static) getRootContext() → {Window|Object}

Gets root context object, Window for browsers and global obkect for Node.
Source:
See:
Returns:
Type:
Window | Object
Returns root context object.

(static) loadScript(src, timeoutopt) → (non-null) {Promise}

Loads script.
Source:
Parameters:
Name Type Attributes Default Description
src string The script source to load.
timeout number <optional>
1000 The maximum execution timeout in seconds.
Returns:
Type:
Promise
Returns the result as a Promise object.

(static) makeNode(tagName) → (nullable) {Element}

Alias of W3C document.createElement. Used to reduce size after code compilation.
Source:
Parameters:
Name Type Description
tagName string Tag name.
Returns:
Type:
Element
Returns created element.