createTreeWalker

fun createTreeWalker(root: Node, whatToShow: Int = definedExternally, filter: NodeFilter? = definedExternally): TreeWalker(source)

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

Parameters

root

The root element or node to start traversing on.

whatToShow

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

filter

A custom NodeFilter function to use.

MDN Reference