3 <script src=traversal.js
language=
"JavaScript" type=
"text/JavaScript" ></script>
4 <title>Traversal Test
</title>
8 <span id=
"A"></span><span id=
"B"></span><span id=
"C"><span id=
"D" marked=
"YES"></span><span id=
"E"></span><span id=
"F"></span></span><span id=
"G"></span><span id=
"H"></span><span id=
"I"></span>
10 <div style=
"font-family: Courier; font-size: 14;">
12 if (window
.testRunner
)
13 testRunner
.dumpAsText();
15 var parent
= document
.getElementById('test');
16 //var root = document.getElementById('A');
19 function testNodeFiter(n
)
21 if (n
.getAttribute('marked') == 'YES') return NodeFilter
.FILTER_ACCEPT
;
22 return NodeFilter
.FILTER_SKIP
;
25 var it
= document
.createNodeIterator(root
, NodeFilter
.SHOW_ELEMENT
, testNodeFiter
, false);
27 while ((n
= it
.nextNode())) {
28 out
+= "<br>" + n
.tagName
+ ": " + n
.id
;