TreeWalker
objects are used to navigate a document tree or subtree using the view of the document defined by its
whatToShow
flags and any filters that are defined for the
TreeWalker
. Any function which performs navigation using a
TreeWalker
will automatically support any view defined by a
TreeWalker
.
Omitting nodes from the logical view of a subtree can result in a structure that is substantially different from the same subtree in the complete, unfiltered document. Nodes that are siblings in the TreeWalker view may be children of different, widely separated nodes in the original view. For instance, consider a Filter that skips all nodes except for Text nodes and the root node of a document. In the logical view that results, all text nodes will be siblings and appear as direct children of the root node, no matter how deeply nested the structure of the original document.
@since DOM Level 2