TreeWalker extension type

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

A TreeWalker can be created using the Document.createTreeWalker method.


API documentation sourced from MDN Web Docs.

on
Implemented types
Available extensions

Properties

currentNode Node
The TreeWalker.currentNode property represents the Node which the TreeWalker is currently pointing at.
getter/setter pair
filter NodeFilter?
The TreeWalker.filter read-only property returns a NodeFilter that is the filtering object associated with the TreeWalker.
no setter
hashCode int
The hash code for this object.
no setterinherited
root Node
The TreeWalker.root read-only property returns the node that is the root of what the TreeWalker traverses.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
whatToShow int
The TreeWalker.whatToShow read-only property returns a bitmask that indicates the types of nodes to show. Non-matching nodes are skipped, but their children may be included, if relevant. The possible values are:
no setter

Methods

firstChild() Node?
The TreeWalker.firstChild() method moves the current Node to the first visible child of the current node, and returns the found child. If no such child exists, it returns null and the current node is not changed.
lastChild() Node?
The TreeWalker.lastChild() method moves the current Node to the last visible child of the current node, and returns the found child. If no such child exists, it returns null and the current node is not changed.
nextNode() Node?
The TreeWalker.nextNode() method moves the current Node to the next visible node in the document order, and returns the found node. If no such node exists, it returns null and the current node is not changed.
nextSibling() Node?
The TreeWalker.nextSibling() method moves the current Node to its next sibling, if any, and returns the found sibling. If there is no such node, it returns null and the current node is not changed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parentNode() Node?
The TreeWalker.parentNode() method moves the current Node to the first visible ancestor node in the document order, and returns the found node. If no such node exists, or if it is above the TreeWalker's root node, it returns null and the current node is not changed.
previousNode() Node?
The TreeWalker.previousNode() method moves the current Node to the previous visible node in the document order, and returns the found node. If no such node exists, or if it is before that the root node defined at the object construction, it returns null and the current node is not changed.
previousSibling() Node?
The TreeWalker.previousSibling() method moves the current Node to its previous sibling, if any, and returns the found sibling. If there is no such node, it returns null and the current node is not changed.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited