test_bug159849.html (1220B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=159849 5 --> 6 <head> 7 <title>Test for Bug 159849</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=159849">Mozilla Bug 159849</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 <pre id="test"> 18 <script class="testbody" type="text/javascript"> 19 20 /** Test for Bug 159849 */ 21 function testFunc() { 22 } 23 24 var c = $("content"); 25 // Intentionally testing the 'with' statement. 26 /* eslint-disable-next-line no-with */ 27 with (c) { 28 onmouseover = testFunc; 29 fooExpando = testFunc; 30 } 31 32 is(c.onmouseover, testFunc, "Event handler should have been set on node"); 33 ok(c.fooExpando === undefined, 34 "Expando should not have been set on node - " + 35 "got " + repr(c.fooExpando) + ", expected undefined"); 36 ok(window.onmouseover === null, 37 "Event handler should not have been set on window - " + 38 "got " + repr(window.onmouseover) + ", expected undefined"); 39 is(window.fooExpando, testFunc, "Expando should have been set on window"); 40 </script> 41 </pre> 42 </body> 43 </html>