| OLD | NEW |
| 1 <html xmlns="http://www.w3.org/1999/xhtml"> | 1 <html xmlns="http://www.w3.org/1999/xhtml"> |
| 2 <head> | 2 <head> |
| 3 <title>DOM Traversal: NodeIterator: Basics</title> | 3 <title>DOM Traversal: NodeIterator: Basics</title> |
| 4 <script type="text/javascript"> <![CDATA[ | 4 <script type="text/javascript"> <![CDATA[ |
| 5 function doTest() { | 5 function doTest() { |
| 6 if (window.testRunner) testRunner.dumpAsText(); | 6 if (window.testRunner) testRunner.dumpAsText(); |
| 7 var iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL,
null, false); | 7 var iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL,
null, false); |
| 8 var expected = new Array(9, // document | 8 var expected = new Array(9, // document |
| 9 1, // html | 9 1, // html |
| 10 3, 1, // head | 10 3, 1, // head |
| 11 3, 1, 3, // title | 11 3, 1, 3, // title |
| 12 3, 1, 3, 4, // script and CDATA block | 12 3, 1, 3, // script |
| 13 3, 3, 1, // body | 13 3, 3, 1, // body |
| 14 3, 1, 3, // pre | 14 3, 1, 3, // pre |
| 15 3, // </body> | 15 3, // </body> |
| 16 3, 8, // <!-- --> | 16 3, 8, // <!-- --> |
| 17 3, 7, // <? ?>, | 17 3, 7, // <? ?>, |
| 18 3, 4, 3); // CDATA | 18 3); // CDATA merged with text |
| 19 var found = new Array(); | 19 var found = new Array(); |
| 20 | 20 |
| 21 // walk document | 21 // walk document |
| 22 var node; | 22 var node; |
| 23 while (node = iterator.nextNode()) | 23 while (node = iterator.nextNode()) |
| 24 found.push(node.nodeType); | 24 found.push(node.nodeType); |
| 25 | 25 |
| 26 // check results | 26 // check results |
| 27 var errors = 0; | 27 var errors = 0; |
| 28 var s = ''; | 28 var s = ''; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 44 p.firstChild.data = 'PASS'; | 44 p.firstChild.data = 'PASS'; |
| 45 } | 45 } |
| 46 ]]></script> | 46 ]]></script> |
| 47 </head> | 47 </head> |
| 48 <body onload="doTest()"> | 48 <body onload="doTest()"> |
| 49 <pre id="result">FAIL: Script failed to run.</pre> | 49 <pre id="result">FAIL: Script failed to run.</pre> |
| 50 </body> | 50 </body> |
| 51 <!-- some more nodes to test this: --> | 51 <!-- some more nodes to test this: --> |
| 52 <?test node?> | 52 <?test node?> |
| 53 <![CDATA[ ]]> | 53 <![CDATA[ ]]> |
| 54 </html> | 54 </html> |
| OLD | NEW |