DOM & HTML
TreeWalker
Traverse nodes of a DOM subtree using specified node types and filter conditions.
Checking support...
Feature Not SupportedThis browser does not support the TreeWalker Web API feature. Try testing in a modern browser (such as Chrome, Edge, Safari, or Firefox).
Advertisement
Interactive Input Workspace
Ready for input
Web API Execution Output
Result output will be displayed here after processing...
Native JavaScript Code Example (Zero Libraries)
const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT);
while(walker.nextNode()) { console.log(walker.currentNode.tagName); }About the TreeWalker Web API
TreeWalker object represents the nodes of a document subtree and a position within them.
Specification:W3C & WHATWG Web API Standard
Sponsored Content