Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / flags-unset-on-init-event.html
blob0645fb8a4d7203e1b7f78418859601bd0a6195d9
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <script src="../../resources/js-test.js"></script>
6 </head>
7 <body>
8 <input id=target type=text value="">
9 <script>
10 description("An event's 'stop propagation', 'stop immediate propagation' and 'canceled' flags should be unset in initEvent");
12 window.jsTestIsAsync = true;
14 var e = document.createEvent("Event");
15 e.initEvent("foo", true, true);
17 e.preventDefault();
18 shouldBeTrue("e.defaultPrevented");
19 e.stopPropagation();
20 e.stopImmediatePropagation();
22 debug("Running e.initEvent again.");
23 e.initEvent("foo", true, true);
24 shouldBeFalse("e.defaultPrevented");
26 var target = document.getElementById("target");
28 target.addEventListener("foo", function (ev) {
29 // This function will run if the propagation flags were reset properly on
30 // the second call to initEvent.
31 finishJSTest();
32 }, false);
34 target.dispatchEvent(e);
36 target.parentNode.removeChild(target);
38 </script>
39 </body>
40 </html>