You are here: Reference > JavaScript > client-side > xml handling > properties > whatToShow (NodeIterator, TreeWalker)

whatToShow property (NodeIterator, TreeWalker)

Browser support:
Returns an integer that identifies the types of nodes that can be shown by the current NodeIterator or TreeWalker object.
Note: The TreeWalker and NodeIterator objects and their whatToShow properties are supported in Internet Explorer from version 9.
The visible node types can be specified with the second parameter of the createNodeIterator or createTreeWalker method.


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

Integer that represents the type of the node. Predefined constants are available for the possible values of this property, in the scope of the NodeFilter interface (e.g. NodeFilter.SHOW_ALL).
The value can be any combination of the following integer constants with the bitwise OR operator (the value of a predefined constant appears in parentheses after the constant in hexadecimal form):
Show all Nodes.
SHOW_ATTRIBUTE (0x00000002)
Show Attr nodes.
Show CDATASection nodes.
SHOW_COMMENT (0x00000080)
Show Comment nodes.
SHOW_DOCUMENT (0x00000100)
Show Document nodes.
Show DocumentFragment nodes.
Show DocumentType nodes.
SHOW_ELEMENT (0x00000001)
Show Element nodes.
SHOW_ENTITY (0x00000020)
Show Entity nodes.
Show EntityReference nodes.
SHOW_NOTATION (0x00000800)
Show Notation nodes.
Show ProcessingInstruction nodes.
SHOW_TEXT (0x00000004)
Show Text nodes.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the whatToShow property:
    <script type="text/javascript">
        function TestWhatToShow () {
            if (document.createTreeWalker) {
                var walker = document.createTreeWalker (document.body, NodeFilter.SHOW_ELEMENT, null, true);
                alert ("The type of nodes to show: " + walker.whatToShow);
            else {
                alert ("Your browser does not support the createTreeWalker method!");
    <button onclick="TestWhatToShow ()">Test whatToShow property</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content