1 <html xmlns="http://www.w3.org/1999/xhtml">
3 <title>DOM Traversal: NodeIterator: Removal of the Reference Node (deep check)</title>
4 <script type="text/javascript"> <![CDATA[
8 if (window.testRunner) testRunner.dumpAsText();
9 var iterator = document.createNodeIterator(document.getElementById('root'), NodeFilter.SHOW_ALL, null, false);
10 var root = document.getElementById('root');
11 var A = document.getElementById('A');
12 var AA = document.getElementById('AA');
13 var B = document.getElementById('B');
14 var C = document.getElementById('C');
15 check(iterator.nextNode(), root);
16 check(iterator.nextNode(), A);
17 check(iterator.nextNode(), AA);
18 check(iterator.nextNode(), B);
20 var X = addChildTo(AA);
21 check(iterator.nextNode(), X);
22 check(iterator.previousNode(), X);
24 var Y = addChildTo(AA);
25 check(iterator.previousNode(), Y);
27 document.getElementById('result').firstChild.data = 'FAIL: ' + errors + ' errors:\n' + log;
29 document.getElementById('result').firstChild.data = 'PASS';
31 function check(a, b) {
34 log += 'Found null but expected ' + b + ' (' + b.id + ').\n';
37 log += 'Found ' + a + ' (' + a.id + ') but expected ' + b + ' (' + b.id + ').\n';
43 log += 'Tried removing null node.\n';
45 a.parentNode.removeChild(a);
47 function addChildTo(a) {
48 var x = document.createElementNS('http://www.w3.org/1999/xhtml', 'span');
54 <body onload="doTest()">
55 <pre id="result">FAIL: Script did not complete.</pre>
56 <p><span id="root"><span id="A"><span id="AA"></span></span><span id="B"></span><span id="C"><span id="CC"></span></span></span></p>