| <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 id="A.1"> |
| </span> |
| <span id="A.2"> |
| </span> |
| <span id="A.3"> |
| </span> |
| </span> |
| <span id="B"> |
| <span id="B.1"> |
| <span id="B.1.1"> |
| </span> |
| <span id="B.1.2"> |
| </span> |
| </span> |
| <span id="B.2"> |
| <span id="B.2.1"> |
| </span> |
| </span> |
| </span> |
| <span id="C"> |
| <span id="C.1"> |
| <span id="C.1.1"> |
| <span id="C.1.1.1"> |
| </span> |
| <span id="C.1.1.2"> |
| </span> |
| <span id="C.1.1.3"> |
| </span> |
| </span> |
| <span id="C.1.2"> |
| <span id="C.2.1"> |
| </span> |
| </span> |
| </span> |
| </span> |
| <span id="D"> |
| </span> |
| </div> |
| <div style="font-family: Courier; font-size: 14; white-space: pre"> |
| <script> |
| if (window.layoutTestController) |
| layoutTestController.dumpAsText(); |
| |
| var root = document.getElementById('test'); |
| var start = document.getElementById('B'); |
| |
| function testNodeFiter(n) |
| { |
| if (n.id == 'B.1') |
| return NodeFilter.FILTER_REJECT; |
| if (n.tagName == 'SPAN') |
| return NodeFilter.FILTER_ACCEPT; |
| return NodeFilter.FILTER_SKIP; |
| } |
| |
| var tw1 = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, testNodeFiter, false); |
| tw1.firstChild(); |
| tw1.nextSibling(); |
| document.write(dumpTreeWalker(tw1, start)); |
| |
| </script> |
| </div> |
| </body> |
| </html> |