1description('Test for a specific problem with previousNode that failed in older versions of WebKit.'); 2 3var testElement = document.createElement("div"); 4testElement.innerHTML='<div id="A1"><div id="B1"><div id="C1"></div><div id="C2"><div id="D1"></div><div id="D2"></div></div></div><div id="B2"><div id="C3"></div><div id="C4"></div></div></div>'; 5 6function filter(node) 7{ 8 if (node.id == "C2") 9 return NodeFilter.FILTER_REJECT; 10 return NodeFilter.FILTER_ACCEPT; 11} 12 13var walker = document.createTreeWalker(testElement, NodeFilter.SHOW_ELEMENT, filter, false); 14 15shouldBe("walker.firstChild(); walker.currentNode.id", "'A1'"); 16shouldBe("walker.nextNode(); walker.currentNode.id", "'B1'"); 17shouldBe("walker.nextNode(); walker.currentNode.id", "'C1'"); 18shouldBe("walker.nextNode(); walker.currentNode.id", "'B2'"); 19shouldBe("walker.previousNode(); walker.currentNode.id", "'C1'"); 20 21var successfullyParsed = true; 22