1 <html xmlns="http://www.w3.org/1999/xhtml">
3 <title>DOM Traversal: NodeIterator: Removal of an ancestor of the Reference Node (forwards) (deep check)</title>
4 <script type="text/javascript"> <![CDATA[
8 if (window.layoutTestController) layoutTestController.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 B = document.getElementById('B');
13 var BB = document.getElementById('BB');
14 var C = document.getElementById('C');
15 check(iterator.nextNode(), root);
16 check(iterator.nextNode(), A);
17 check(iterator.nextNode(), B);
18 check(iterator.nextNode(), BB);
20 var X = addChildTo(A);
21 check(iterator.nextNode(), X);
23 document.getElementById('result').firstChild.data = 'FAIL: ' + errors + ' errors:\n' + log;
25 document.getElementById('result').firstChild.data = 'PASS';
27 function check(a, b) {
30 log += 'Found null but expected ' + b + ' (' + b.id + ').\n';
33 log += 'Found ' + a + ' (' + a.id + ') but expected ' + b + ' (' + b.id + ').\n';
39 log += 'Tried removing null node.\n';
41 a.parentNode.removeChild(a);
43 function addChildTo(a) {
44 var x = document.createElementNS('http://www.w3.org/1999/xhtml', 'span');
51 <body onload="doTest()">
52 <pre id="result">FAIL: Script did not complete.</pre>
53 <p><span id="root"><span id="A"></span><span id="B"><span id="BB"></span></span><span id="C"></span></span></p>