3 <script src=traversal.js
language=
"JavaScript" type=
"text/JavaScript" ></script>
4 <title>Traversal Test
</title>
7 <div id=
"test"><span id=
"A"></span><span id=
"B"></span><span id=
"C"></span></div>
8 <div style=
"font-family: Courier; font-size: 14;">
10 if (window
.testRunner
)
11 testRunner
.dumpAsText();
13 var root
= document
.getElementById('test');
15 function testNodeFiter(n
)
17 if (n
.tagName
== 'SPAN') return NodeFilter
.FILTER_ACCEPT
;
18 return NodeFilter
.FILTER_SKIP
;
21 var it
= document
.createNodeIterator(root
, NodeFilter
.SHOW_ELEMENT
, testNodeFiter
, false);
22 for (i
= 0; i
< 3; i
++)
25 document
.write(dumpNodeIterator(it
, "ref node 'C'; pointer before"));
28 document
.write("<p>remove node 'C'");
29 var D
= document
.getElementById('C');
31 document
.write(dumpNodeIterator(it
, "ref node 'B'; pointer after"));