test_bug698929.html (1140B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=698929 5 --> 6 <head> 7 <title>Test for Bug 698929</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=698929">Mozilla Bug 698929</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 <pre id="test"> 18 <script type="application/javascript"> 19 20 /** Test for Bug 698929 */ 21 22 var e = document.createEvent("Event"); 23 e.initEvent("foo", true, true); 24 var c = 0; 25 var b = 0; 26 document.addEventListener("foo", 27 function() { 28 ++c; 29 }); 30 document.body.addEventListener("foo", function(event) { 31 ++b; 32 event.stopImmediatePropagation(); 33 }); 34 document.body.addEventListener("foo", function(event) { 35 ++b; 36 }); 37 document.body.dispatchEvent(e); 38 document.documentElement.dispatchEvent(e); 39 is(c, 1, "Listener in the document should have been called once."); 40 is(b, 1, "Listener in the body should have been called once."); 41 42 43 44 </script> 45 </pre> 46 </body> 47 </html>