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

whatToShow property (NodeIterator, TreeWalker)

Browser support:
9
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.

Syntax:

object.whatToShow;
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 (0xFFFFFFFF)
Show all Nodes.
SHOW_ATTRIBUTE (0x00000002)
Show Attr nodes.
SHOW_CDATA_SECTION (0x00000008)
Show CDATASection nodes.
SHOW_COMMENT (0x00000080)
Show Comment nodes.
SHOW_DOCUMENT (0x00000100)
Show Document nodes.
SHOW_DOCUMENT_FRAGMENT (0x00000400)
Show DocumentFragment nodes.
SHOW_DOCUMENT_TYPE (0x00000200)
Show DocumentType nodes.
SHOW_ELEMENT (0x00000001)
Show Element nodes.
SHOW_ENTITY (0x00000020)
Show Entity nodes.
SHOW_ENTITY_REFERENCE (0x00000010)
Show EntityReference nodes.
SHOW_NOTATION (0x00000800)
Show Notation nodes.
SHOW_PROCESSING_INSTRUCTION (0x00000040)
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:
<head>
    <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!");
            }
        }
    </script>
</head>
<body>
    <button onclick="TestWhatToShow ()">Test whatToShow property</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content