test_bug1298970.html 946 B

12345678910111213141516171819202122232425262728293031323334
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=1298970
  5. -->
  6. <head>
  7. <title>Test for Bug 1298970</title>
  8. <script type="text/javascript" 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=1298970">Mozilla Bug 1298970</a>
  13. <p id="display"></p>
  14. <div id="inner"></div>
  15. <script class="testbody" type="text/javascript">
  16. /** Test for Bug 1298970 **/
  17. var target = document.getElementById("inner");
  18. var event = new Event("test", { bubbles: true, cancelable: true });
  19. is(event.cancelBubble, false, "Event.cancelBubble should be false by default");
  20. target.addEventListener("test", (e) => {
  21. e.stopPropagation();
  22. is(e.cancelBubble, true, "Event.cancelBubble should be true after stopPropagation");
  23. }, true);
  24. target.dispatchEvent(event);
  25. </script>
  26. </body>
  27. </html>