Helpers.Template

A collection of functions to manage DOM nodes and theme templates.

Source:

Methods

(static) appendChildren(el, childrenopt) → {HTMLElement}

Append an array of DOM nodes to a parent.

Parameters:
Name Type Attributes Description
el HTMLElement

The parent DOM node.

children Array | undefined <optional>

The array of children. If no array is passed, then the method silently fails to run.

Source:
Returns:

el - The DOM node that received the attributes.

Type
HTMLElement

(static) createElement(el, childrenopt, attributesopt) → {HTMLElement}

Create a new HTMLElement instance.

Parameters:
Name Type Attributes Description
el HTMLElement

The parent DOM node.

children Array | undefined <optional>

The array of children. If no array is passed, then the method silently fails to run.

attributes Object | undefined <optional>

The attributes object.

Source:
Returns:

el - The DOM node that received the attributes.

Type
HTMLElement

(static) setAttributes(el, attributesopt) → {HTMLElement}

Set the attribute of an element.

Parameters:
Name Type Attributes Description
el HTMLElement

The DOM node that will receive the attributes.

attributes Object | undefined <optional>

The attribute object, or if no object is passed, then the action is ignored.

Source:
Returns:

el - The DOM node that received the attributes.

Type
HTMLElement

(static) swap(subject, existing) → {HTMLElement}

Swap a new DOM node with an existing one.

Parameters:
Name Type Description
subject HTMLElement

The new DOM node.

existing HTMLElement

The existing DOM node.

Source:
Returns:
  • Returns the new element if it was mounted, otherwise the existing node is returned.
Type
HTMLElement