NodeList

NodeList

Return a new NodeList.

Constructor

new NodeList(parent, …nodes)

Source:
Parameters:
Name Type Attributes Description
parent Container
nodes Array.<Node> <repeatable>

Extends

  • Array

Members

innerHTML

Source:

Return the innerHTML of the current Container as a String.

Example
container.innerHTML // returns a string of innerHTML

innerHTML

Source:

Define the nodes of the current NodeList from a String.

Example
nodeList.innerHTML = 'Hello <strong>world</strong>';
nodeList.length; // 2

parent

Source:

Return the parent of the current NodeList.

textContent

Source:

Return the text content of the current NodeList as a String.

textContent

Source:

Define the content of the current NodeList as a new Text Node.

Methods

(static) from(nodes)

Source:

Return a new NodeList from an object.

Example

Return a NodeList from an array of text.

NodeList.from([ 'test' ]) // returns NodeList [ Text { data: 'test' } ]
Parameters:
Name Type Description
nodes Node | Array.<Node>

Array or object of nodes.

clone(parent) → {NodeList}

Source:

Return a clone of the current NodeList.

Parameters:
Name Type Description
parent Node

New parent containing the cloned NodeList.

Returns:
Type
NodeList

pop() → {Node}

Source:

Remove and return the last Node in the NodeList.

Returns:
Type
Node

push() → {number}

Source:

Add Nodes to the end of the NodeList and return the new length of the NodeList.

Returns:
Type
number

shift() → {Node}

Source:

Remove and return the first Node in the NodeList.

Returns:
Type
Node

splice()

Source:

Add and remove Nodes to and from the NodeList.

toJSON() → {Array.<(Node|string)>}

Source:

Return the current NodeList as an Array.

Example
nodeList.toJSON() // returns []
Returns:
Type
Array.<(Node|string)>

toString()

Source:

Return the current NodeList as a String.

Example
nodeList.toString() // returns ''

unshift()

Source:

Add Nodes to the beginning of the NodeList and return the new length of the NodeList.