1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/test_bug338541.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +<html xmlns="http://www.w3.org/1999/xhtml"> 1.5 +<!-- 1.6 +https://bugzilla.mozilla.org/show_bug.cgi?id=338541 1.7 +--> 1.8 +<head> 1.9 + <title>Test for Bug 338541</title> 1.10 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.11 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.12 +</head> 1.13 +<body> 1.14 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=338541">Mozilla Bug 338541</a> 1.15 +<p id="display"></p> 1.16 +<pre id="test"> 1.17 +<script class="testbody" type="text/javascript"> 1.18 + 1.19 +/** Test for Bug 338541 **/ 1.20 +function getName(aNode, f) 1.21 +{ 1.22 + return (aNode ? aNode.nodeName : "(null)"); 1.23 +} 1.24 + 1.25 +function walkDOM() 1.26 +{ 1.27 + var walker = document.createTreeWalker($('content'), NodeFilter.SHOW_ELEMENT, null); 1.28 + var output = ""; 1.29 + while (walker.nextNode()) 1.30 + { 1.31 + output += getName(walker.currentNode) + "\n"; 1.32 + } 1.33 + output += "Final currentNode: " + getName(walker.currentNode); 1.34 + is(output, "foo\nbar\nhtml:b\nqux\nbaz\nFinal currentNode: baz","treewalker returns correct nodeName"); 1.35 + SimpleTest.finish(); 1.36 +} 1.37 + 1.38 +SimpleTest.waitForExplicitFinish(); 1.39 +addLoadEvent(walkDOM, ok); 1.40 + 1.41 +</script> 1.42 +</pre> 1.43 +<div id="content" style="display: none"> 1.44 + <foo xmlns="http://example.com"> 1.45 + <bar><html:b xmlns:html="http://www.w3.org/1999/xhtml"><qux/></html:b> 1.46 + <baz/> 1.47 + </bar> 1.48 + </foo> 1.49 +</div> 1.50 +</body> 1.51 +</html> 1.52 +