Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <html xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 2 | <!-- |
michael@0 | 3 | https://bugzilla.mozilla.org/show_bug.cgi?id=338541 |
michael@0 | 4 | --> |
michael@0 | 5 | <head> |
michael@0 | 6 | <title>Test for Bug 338541</title> |
michael@0 | 7 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 8 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 9 | </head> |
michael@0 | 10 | <body> |
michael@0 | 11 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=338541">Mozilla Bug 338541</a> |
michael@0 | 12 | <p id="display"></p> |
michael@0 | 13 | <pre id="test"> |
michael@0 | 14 | <script class="testbody" type="text/javascript"> |
michael@0 | 15 | |
michael@0 | 16 | /** Test for Bug 338541 **/ |
michael@0 | 17 | function getName(aNode, f) |
michael@0 | 18 | { |
michael@0 | 19 | return (aNode ? aNode.nodeName : "(null)"); |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | function walkDOM() |
michael@0 | 23 | { |
michael@0 | 24 | var walker = document.createTreeWalker($('content'), NodeFilter.SHOW_ELEMENT, null); |
michael@0 | 25 | var output = ""; |
michael@0 | 26 | while (walker.nextNode()) |
michael@0 | 27 | { |
michael@0 | 28 | output += getName(walker.currentNode) + "\n"; |
michael@0 | 29 | } |
michael@0 | 30 | output += "Final currentNode: " + getName(walker.currentNode); |
michael@0 | 31 | is(output, "foo\nbar\nhtml:b\nqux\nbaz\nFinal currentNode: baz","treewalker returns correct nodeName"); |
michael@0 | 32 | SimpleTest.finish(); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 36 | addLoadEvent(walkDOM, ok); |
michael@0 | 37 | |
michael@0 | 38 | </script> |
michael@0 | 39 | </pre> |
michael@0 | 40 | <div id="content" style="display: none"> |
michael@0 | 41 | <foo xmlns="http://example.com"> |
michael@0 | 42 | <bar><html:b xmlns:html="http://www.w3.org/1999/xhtml"><qux/></html:b> |
michael@0 | 43 | <baz/> |
michael@0 | 44 | </bar> |
michael@0 | 45 | </foo> |
michael@0 | 46 | </div> |
michael@0 | 47 | </body> |
michael@0 | 48 | </html> |
michael@0 | 49 |