Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / traversal / tree-walker-003.html
1 <html> 
2 <head>
3 <script src=traversal.js language="JavaScript" type="text/JavaScript" ></script>
4 <title>Traversal Test</title> 
5 </head> 
6 <body>
7 <div id="test">
8 <span id="A">
9     <span id="A.1">
10     </span>
11     <span id="A.2">
12     </span>
13     <span id="A.3">
14     </span>
15 </span>
16 <span id="B">
17     <span id="B.1">
18         <span id="B.1.1">
19         </span>
20         <span id="B.1.2">
21         </span>
22     </span>
23     <span id="B.2">
24         <span id="B.2.1">
25         </span>
26     </span>
27 </span>
28 <span id="C">
29     <span id="C.1">
30         <span id="C.1.1">
31             <span id="C.1.1.1">
32             </span>
33             <span id="C.1.1.2">
34             </span>
35             <span id="C.1.1.3">
36             </span>
37         </span>
38         <span id="C.1.2">
39             <span id="C.2.1">
40             </span>
41         </span>
42     </span>
43 </span>
44 <span id="D">
45 </span>
46 </div>
47 <div style="font-family: Courier; font-size: 14; white-space: pre">
48 <script>
49 if (window.testRunner)
50     testRunner.dumpAsText();
51
52 var root = document.getElementById('test');
53 var start = document.getElementById('A');
54
55 function testNodeFiter(n)
56 {
57     if (n.tagName == 'SPAN') {
58         if (n.id == 'B.1' || n.id == 'C.1.1')
59             return NodeFilter.FILTER_REJECT;
60         return NodeFilter.FILTER_ACCEPT;
61     }
62     return NodeFilter.FILTER_SKIP;
63 }
64
65 var tw1 = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, testNodeFiter, false);
66 document.write(dumpTreeWalker(tw1, start));
67
68 var tw2 = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, testNodeFiter, false);
69 document.write(dumpTreeWalker(tw2, start, document.getElementById('D'), true));
70
71 </script>
72 </div>
73 </body>
74 </html>