<html> <head> <script src=traversal.js language="JavaScript" type="text/JavaScript" ></script> <title>Traversal Test</title> </head> <body> <div id="test"> <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> </div> <div style="font-family: Courier; font-size: 14;"> <script> if (window.testRunner) testRunner.dumpAsText(); var root = document.getElementById('test'); function testNodeFiter(n) { if (n.tagName == 'SPAN') return NodeFilter.FILTER_ACCEPT; return NodeFilter.FILTER_SKIP; } var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT, testNodeFiter, false); for (i = 0; i < 4; i++) it.nextNode(); document.write(dumpNodeIterator(it, "ref node 'D'; pointer after")); // remove node 'D' document.write("<p>remove node 'D'"); root.removeChild(document.getElementById('D')); document.write(dumpNodeIterator(it, "ref node 'C'; pointer after")); </script> </div> </body> </html>