Table of Contents

Class TreeWalker

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

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

[Value("TreeWalker")]
public class TreeWalker
Inheritance
TreeWalker
Inherited Members

Remarks

A TreeWalker can be created using the CreateTreeWalker(Node, ulong, NodeFilter?) method.

-The creator method: CreateTreeWalker(Node, ulong, NodeFilter?).
-Related interface: NodeIterator.

See also on MDN

Constructors

TreeWalker()

public TreeWalker()

Properties

CurrentNode

The TreeWalker.currentNode property represents the
Node which the TreeWalker is currently pointing at.

[Value("currentNode")]
public Node CurrentNode { get; set; }

Property Value

Node

A Node.

Remarks

Filter

The TreeWalker.filter read-only property returns the NodeFilter
associated with the TreeWalker.

[Value("filter")]
public NodeFilter? Filter { get; }

Property Value

NodeFilter

A NodeFilter object.

Remarks

When creating the TreeWalker, the filter object is passed in as the third
parameter, and its method acceptNode() is called on every
single node to determine whether or not to accept it.

-The TreeWalker interface it belongs to.

See also on MDN

Root

The TreeWalker.root read-only property returns the root Node that the TreeWalker traverses.

[Value("root")]
public Node Root { get; }

Property Value

Node

A Node object.

Remarks

WhatToShow

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:

[Value("whatToShow")]
public ulong WhatToShow { get; }

Property Value

ulong

A bitmask.

Remarks

Methods

FirstChild()

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.

[Value("firstChild")]
public Node? FirstChild()

Returns

Node

A Node object or null.

Remarks

-The TreeWalker interface it belongs to.

See also on MDN

LastChild()

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.

[Value("lastChild")]
public Node? LastChild()

Returns

Node

A Node object or null.

Remarks

-The TreeWalker interface it belongs to.

See also on MDN

NextNode()

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.

[Value("nextNode")]
public Node? NextNode()

Returns

Node

A Node object or null.

Remarks

-The TreeWalker interface it belongs to.

See also on MDN

NextSibling()

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.

[Value("nextSibling")]
public Node? NextSibling()

Returns

Node

A Node object or null.

Remarks

-The TreeWalker interface it belongs to.

See also on MDN

ParentNode()

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.

[Value("parentNode")]
public Node? ParentNode()

Returns

Node

A Node object or null.

Remarks

-The TreeWalker interface it belongs to.

See also on MDN

PreviousNode()

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.

[Value("previousNode")]
public Node? PreviousNode()

Returns

Node

A Node object or null.

Remarks

-The TreeWalker interface it belongs to.

See also on MDN

PreviousSibling()

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.

[Value("previousSibling")]
public Node? PreviousSibling()

Returns

Node

A Node object or null.

Remarks

-The TreeWalker interface it belongs to.

See also on MDN