NodeList

NodeList

Create a new NodeList.

Constructor

new NodeList(parent, …nodes) → {NodeList}

Source:
Parameters:
Name Type Attributes Description
parent Object

Parent containing the current NodeList.

nodes Node <repeatable>

Nodes belonging to the current NodeList.

Returns:
Type
NodeList

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

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) → {NodeList}

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 Array | Node

An array or object of nodes.

Returns:

A new NodeList

Type
NodeList

clone(parent) → {NodeList}

Source:

Return a clone of the current NodeList.

Parameters:
Name Type Description
parent Object

New parent containing the cloned NodeList.

Returns:
  • The cloned NodeList
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() → {Array}

Source:

Add and remove Nodes to and from the NodeList.

Returns:
Type
Array

toJSON() → {Array}

Source:

Return the current NodeList as an Array.

Example
nodeList.toJSON() // returns []
Returns:
Type
Array

toString() → {String}

Source:

Return the current NodeList as a String.

Example
nodeList.toString() // returns ''
Returns:
Type
String

unshift() → {Number}

Source:

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

Returns:
Type
Number