Help Center

Local Navigation

Object: NodeFilter

Availability

BlackBerry® Device Software version 4.6 or later

The NodeFilter object is used to filter out nodes. If a NodeIterator or TreeWalker is given a NodeFilter, it applies the filter before it returns the next node. If the filter says to accept the node, the traversal object, either a NodeIterator or TreeWalker, returns it; otherwise, the traversal object looks for the next node and acts as if that the node that was rejected was not there.

NodeFilter methods

Method name

Description

Availability

acceptNode()

Tests whether a specified node is visible in the logical view of a NodeIterator or TreeWalker.

4.6 or later

Method: NodeFilter.acceptNode()

Availability

BlackBerry® Device Software version 4.6 or later

The acceptNode() method tests whether a specified node is visible in the logical view of a NodeIterator or TreeWalker. This method is normally called by the NodeIterator or TreeWalker object, rather than as part of the JavaScript® code.

Syntax

NodeFilter.acceptNode( n )

Parameters

Parameter

Type

Description

n

Node

The node to check.

Return values

Returns a constant that that determines whether the node is accepted, rejected, or skipped.

Constant

Definition

Description

1

FILTER_ACCEPT

Navigation methods defined for NodeIterator or TreeWalker will return the node.

2

FILTER_REJECT

Navigation methods defined for NodeIterator or TreeWalker will not return the node. In the case of NodeIterator, this is equivalent to FILTER_SKIP. In the case of TreeWalker, the children of the node are also rejected.

3

FILTER_SKIP

Navigation methods defined for NodeIterator or TreeWalker will not return the node; however, children of this node are still considered.

Exceptions

None.

Next topic: Object: NodeList

Was this information helpful? Send us your comments.