You are here: Reference > JavaScript > client-side > xml handling > properties > whatToShow (NodeIterator, TreeWalker)
whatToShow property (NodeIterator, TreeWalker)
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:
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 Attr nodes. | |||||||
Show CDATASection nodes. | |||||||
Show Comment nodes. | |||||||
Show Document nodes. | |||||||
Show DocumentFragment nodes. | |||||||
Show DocumentType nodes. | |||||||
Show Element nodes. | |||||||
Show Entity nodes. | |||||||
Show EntityReference nodes. | |||||||
Show Notation nodes. | |||||||
Show ProcessingInstruction nodes. | |||||||
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?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments