TreeWalker

open class TreeWalker(source)

The TreeWalker object represents the nodes of a document subtree and a position within them.

MDN Reference

Properties

Link copied to clipboard

The TreeWalker.currentNode property represents the Node which the TreeWalker is currently pointing at.

Link copied to clipboard

The TreeWalker.filter read-only property returns the NodeFilter associated with the TreeWalker.

Link copied to clipboard
val root: Node

The TreeWalker.root read-only property returns the root Node that the TreeWalker traverses.

Link copied to clipboard

The TreeWalker.whatToShow read-only property returns a bitmask that indicates the types of nodes to show.

Functions

Link copied to clipboard

The TreeWalker.firstChild() method moves the current Node to the first visible child of the current node, and returns the found child.

Link copied to clipboard
fun lastChild(): Node?

The TreeWalker.lastChild() method moves the current Node to the last visible child of the current node, and returns the found child.

Link copied to clipboard
fun nextNode(): Node?

The TreeWalker.nextNode() method moves the current Node to the next visible node in the document order, and returns the found node.

Link copied to clipboard

The TreeWalker.nextSibling() method moves the current Node to its next sibling, if any, and returns the found sibling.

Link copied to clipboard

The TreeWalker.parentNode() method moves the current Node to the first visible ancestor node in the document order, and returns the found node.

Link copied to clipboard

The TreeWalker.previousNode() method moves the current Node to the previous visible node in the document order, and returns the found node.

Link copied to clipboard

The TreeWalker.previousSibling() method moves the current Node to its previous sibling, if any, and returns the found sibling.