3 <script language=
"JavaScript">
5 testRunner
.dumpAsText();
7 function log(message
) {
8 var console
= document
.getElementById("console");
9 var li
= document
.createElement("li");
10 var text
= document
.createTextNode(message
);
12 console
.appendChild(li
);
15 function iteratorTest() {
16 log("NodeIterator: testing nextNode() (5 should be null)");
17 var iterator
= document
.createNodeIterator(divB
, NodeFilter
.SHOW_ELEMENT
, null, false);
20 log(iterator
.nextNode());
22 log("NodeIterator: testing previousNode() (7 should be null)");
23 iterator
= document
.createNodeIterator(divB
, NodeFilter
.SHOW_ELEMENT
, null, false);
24 log(iterator
.previousNode());
26 log("TreeWalker: testing nextNode() (11 should be null)");
27 iterator
= document
.createTreeWalker(divB
, NodeFilter
.SHOW_ELEMENT
, null, false);
29 log(iterator
.nextNode());
31 log("TreeWalker: testing previousNode() (13 should be null)");
32 iterator
= document
.createTreeWalker(divB
, NodeFilter
.SHOW_ELEMENT
, null, false);
33 log(iterator
.previousNode());
40 This test checks that the NodeIterator and TreeWalker functions do not go past the root element that they are supposed to stay within.
50 <ol id=
"console" > </ol>