Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

createTreeWalker method

Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document.

Document Object Model (DOM) Level 2 Traversal and Range Specification, Section 1.2Internet Explorer 9



var ppTreeWalker = document.createTreeWalker(pRootNode, ulWhatToShow, pFilter, fEntityReferenceExpansion);


pRootNode [in]

Type: Node

The root element or node to start traversing on.

ulWhatToShow [in]

Type: Integer

The type of nodes or elements to appear in the node list. For more information, see whatToShow.

pFilter [in]

Type: Variant

A custom NodeFilter function to use. For more information, see filter. Use a pointer to a null value for no filter.

fEntityReferenceExpansion [in]

Type: Boolean

A flag that specifies whether entity reference nodes are expanded. For more information, see expandEntityReferences.

ppTreeWalker [out, retval]

Type: TreeWalker

Returns a TreeWalker object.

Return value

Type: TreeWalker

Returns a TreeWalker object.

Standards information


Use the createTreeWalker method when you want to navigate a representation of the document's hierarchical structure. If you would rather traverse a sequence of nodes without regard to document structure, use createNodeIterator.

When a custom NodeFilter function isn't needed, use a pointer to a null value rather than just a null value.

See also




© 2017 Microsoft