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><span id=
"D"></span><span id=
"E"></span><span id=
"F"></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 root
= document
.getElementById('test');
17 function testNodeFiter(n
)
19 if (n
.tagName
== 'SPAN') return NodeFilter
.FILTER_ACCEPT
;
20 return NodeFilter
.FILTER_SKIP
;
23 var it
= document
.createNodeIterator(root
, NodeFilter
.SHOW_ELEMENT
, testNodeFiter
, false);
24 for (i
= 0; i
< 5; i
++)
27 document
.write(dumpNodeIterator(it
, "ref node 'E'; pointer before"));
30 document
.write("<p>remove node 'E'");
31 root
.removeChild(document
.getElementById('E'));
32 document
.write(dumpNodeIterator(it
, "ref node 'F'; pointer before"));