blob: 52b24fbca707d08e60ba295bf278e527abd6ec6c [file] [log] [blame]
<html>
<head>
<script src=traversal.js language="JavaScript" type="text/JavaScript" ></script>
<title>Traversal Test</title>
</head>
<body>
<div id="test">
<span id="A">
<span id="A.1">
</span>
<span id="A.2">
</span>
<span id="A.3">
</span>
</span>
<span id="B">
<span id="B.1">
<span id="B.1.1">
</span>
<span id="B.1.2">
</span>
</span>
<span id="B.2">
<span id="B.2.1">
</span>
</span>
</span>
<span id="C">
<span id="C.1">
<span id="C.1.1">
<span id="C.1.1.1">
</span>
<span id="C.1.1.2">
</span>
<span id="C.1.1.3">
</span>
</span>
<span id="C.1.2">
<span id="C.2.1">
</span>
</span>
</span>
</span>
<span id="D">
</span>
</div>
<div style="font-family: Courier; font-size: 14; white-space: pre">
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
var root = document.getElementById('test');
var start = document.getElementById('A');
function testNodeFiter(n)
{
if (n.tagName == 'SPAN') {
if (n.id == 'B.1' || n.id == 'C.1.1')
return NodeFilter.FILTER_REJECT;
return NodeFilter.FILTER_ACCEPT;
}
return NodeFilter.FILTER_SKIP;
}
var tw1 = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, testNodeFiter, false);
document.write(dumpTreeWalker(tw1, start));
var tw2 = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, testNodeFiter, false);
document.write(dumpTreeWalker(tw2, start, document.getElementById('D'), true));
</script>
</div>
</body>
</html>