test_bug738108.html (1294B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=738108 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 738108</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=738108">Mozilla Bug 738108</a> 14 <p id="display"></p> 15 <div id="content" style="display: none"> 16 <div id="foo"></div> 17 </div> 18 <pre id="test"> 19 <script type="application/javascript"> 20 21 /** Test for Bug 738108 */ 22 is(document.querySelector("#foo"), $("foo"), 23 "querySelector on document should find element by id") 24 is($("content").querySelector("#foo"), $("foo"), 25 "querySelector on parent element should find element by id") 26 is($("foo").querySelector("#foo"), null, 27 "querySelector on element should not find the element itself by id") 28 29 is(document.querySelectorAll("#foo").length, 1, 30 "querySelectorAll on document should find element by id") 31 is($("content").querySelectorAll("#foo").length, 1, 32 "querySelectorAll on parent element should find element by id") 33 is($("foo").querySelectorAll("#foo").length, 0, 34 "querySelectorall on element should not find the element itself by id") 35 36 </script> 37 </pre> 38 </body> 39 </html>