Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / traversal / node-iterator-002.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"></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>
9 </div>
10 <div style="font-family: Courier; font-size: 14;">
11 <script>
12 if (window.testRunner)
13     testRunner.dumpAsText();
14
15 var root = document.getElementById('test');
16
17 function testNodeFiter(n)
18 {
19     if (n.tagName == 'SPAN') return NodeFilter.FILTER_ACCEPT;
20     return NodeFilter.FILTER_SKIP;
21 }
22
23 var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT, testNodeFiter, false);
24 for (i = 0; i < 4; i++)
25     it.nextNode();
26 document.write(dumpNodeIterator(it, "ref node 'D'; pointer after"));
27
28 // remove node 'E'
29 document.write("<p>remove node 'E'");
30 root.removeChild(document.getElementById('E'));
31 document.write(dumpNodeIterator(it, "ref node 'D'; pointer after"));
32
33 // insert new node 'X' before 'F'
34 document.write("<p>insert new node 'X' before 'F'");
35 var X = document.createElement('SPAN');
36 X.setAttribute('ID', 'X');
37 root.insertBefore(X, document.getElementById('F'));
38 document.write(dumpNodeIterator(it, "ref node 'D'; pointer after"));
39
40 // move node 'I' before 'X'
41 document.write("<p>move node 'I' before 'X'");
42 var I = document.getElementById('I');
43 root.removeChild(I);
44 root.insertBefore(I, X);
45 document.write(dumpNodeIterator(it, "ref node 'D'; pointer after"));
46 </script>
47 </div>
48 </body>
49 </html>