ElementsTreeWalker

ElementsTreeWalker

Tree walker that walks only on element nodes.

Constructor

new ElementsTreeWalker(startNodeopt, rootopt)

Source:

Create an elements tree walker.

Parameters:
Name Type Attributes Description
startNode Node | external:Node <optional>
root Node | external:Node <optional>

Extends

Methods

firstChild() → (nullable) {Node}

Source:
Overrides:

Go to the first child node.

Returns:
Type
Node

lastChild() → (nullable) {Node}

Source:
Overrides:

Go to the last child node.

Returns:
Type
Node

nextNode() → (nullable) {Node}

Source:
Overrides:

Go to the next node (don't confuse with the next sibling).

Returns:
Type
Node

nextSibling() → (nullable) {Node}

Source:
Overrides:

Go to the next sibling node.

Returns:
Type
Node

parentNode() → (nullable) {Node}

Source:
Overrides:

Go to the parent node.

Returns:
Type
Node

previousNode() → (nullable) {Node}

Source:
Overrides:

Go to the previous node (don't confuse with the previous sibling).

Returns:
Type
Node

previousSibling() → (nullable) {Node}

Source:
Overrides:

Go to the previous sibling node.

Returns:
Type
Node

(protected) tryMove(prop) → (nullable) {Node}

Source:
Overrides:

Try changing the current node to a node specified by the property.

Parameters:
Name Type Description
prop string
Returns:
Type
Node