NodeIterator.whatToShow

  • Revision slug: DOM/NodeIterator.whatToShow
  • Revision title: NodeIterator.whatToShow
  • Revision id: 136559
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment page created, 106 words added

Revision Content

{{ DomRef() }}

{{ fx_minversion_header("3") }}

Summary

Returns a number signifying what types of nodes should be returned by the NodeIterator.

Syntax

var nodeTypes = nodeIterator.whatToShow;

Example

var nodeIterator = document.createNodeIterator(
    document.body,
    NodeFilter.SHOW_ELEMENT + NodeFilter.SHOW_COMMENT + NodeFilter.SHOW_TEXT,
    { acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } },
    false
);
if( (nodeIterator.whatToShow == NodeFilter.SHOW_ALL) ||
    (nodeIterator.whatToShow % (NodeFilter.SHOW_COMMENT*2)) >= NodeFilter.SHOW_COMMENT) {
    // nodeIterator will show comments
}

Notes

Valid flags for whatToShow are:

NodeFilter.SHOW_ALL = -1
NodeFilter.SHOW_ELEMENT = 1
NodeFilter.SHOW_ATTRIBUTE = 2
NodeFilter.SHOW_TEXT = 4
NodeFilter.SHOW_CDATA_SECTION = 8
NodeFilter.SHOW_ENTITY_REFERENCE = 16
NodeFilter.SHOW_ENTITY = 32
NodeFilter.SHOW_PROCESSING_INSTRUCTION = 64
NodeFilter.SHOW_COMMENT = 128
NodeFilter.SHOW_DOCUMENT = 256
NodeFilter.SHOW_DOCUMENT_TYPE = 512
NodeFilter.SHOW_DOCUMENT_FRAGMENT = 1024
NodeFilter.SHOW_NOTATION = 2048

Revision Source

<p>{{ DomRef() }}</p>
<p>{{ fx_minversion_header("3") }}</p>
<h3 name="Summary">Summary</h3>
<p>Returns a number signifying what types of nodes should be returned by the <a class="internal" href="/En/DOM/NodeIterator" title="En/DOM/NodeIterator"><code>NodeIterator</code></a>.</p>
<h3 name="Syntax">Syntax</h3>
<pre class="eval">var nodeTypes = nodeIterator.whatToShow;
</pre>
<h3 name="Example">Example</h3>
<pre class="eval">var nodeIterator = document.createNodeIterator(
    document.body,
    NodeFilter.SHOW_ELEMENT + NodeFilter.SHOW_COMMENT + NodeFilter.SHOW_TEXT,
    { acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } },
    false
);
if( (nodeIterator.whatToShow == NodeFilter.SHOW_ALL) ||
    (nodeIterator.whatToShow % (NodeFilter.SHOW_COMMENT*2)) &gt;= NodeFilter.SHOW_COMMENT) {
    // nodeIterator will show comments
}
</pre>
<h3 name="Notes">Notes</h3>
<p>Valid flags for <code>whatToShow</code> are:</p>
<pre class="eval">NodeFilter.SHOW_ALL = -1
NodeFilter.SHOW_ELEMENT = 1
NodeFilter.SHOW_ATTRIBUTE = 2
NodeFilter.SHOW_TEXT = 4
NodeFilter.SHOW_CDATA_SECTION = 8
NodeFilter.SHOW_ENTITY_REFERENCE = 16
NodeFilter.SHOW_ENTITY = 32
NodeFilter.SHOW_PROCESSING_INSTRUCTION = 64
NodeFilter.SHOW_COMMENT = 128
NodeFilter.SHOW_DOCUMENT = 256
NodeFilter.SHOW_DOCUMENT_TYPE = 512
NodeFilter.SHOW_DOCUMENT_FRAGMENT = 1024
NodeFilter.SHOW_NOTATION = 2048
</pre>
Revert to this revision