| <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> |
| </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 < 3; i++) |
| it.nextNode(); |
| it.previousNode(); |
| document.write(dumpNodeIterator(it, "ref node 'C'; pointer before")); |
| |
| // remove node 'C' |
| document.write("<p>remove node 'C'"); |
| var D = document.getElementById('C'); |
| root.removeChild(D); |
| document.write(dumpNodeIterator(it, "ref node 'B'; pointer after")); |
| </script> |
| </div> |
| </body> |
| </html> |