Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/Event-propagation.html

Issue 1529523002: Import dom/ from web-platform-tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak W3CImportExpectations Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <title>Event propagation tests</title>
3 <link rel=author title="Aryeh Gregor" href=ayg@aryeh.name>
4 <div id=log></div>
5 <script src=../../../../resources/testharness.js></script>
6 <script src=../../../../resources/testharnessreport.js></script>
7 <script>
8 "use strict";
9
10 function testPropagationFlag(ev, expected, desc) {
11 test(function() {
12 var called = false;
13 var callback = function() { called = true };
14 document.head.addEventListener("foo", callback);
15 document.head.dispatchEvent(ev);
16 // Gecko resets the flags after dispatching; it will happily dispatch
17 // the event the second time around.
18 document.head.dispatchEvent(ev);
19 assert_equals(called, expected, "Propagation flag");
20 document.head.removeEventListener("foo", callback);
21 }, desc);
22 }
23
24 var ev = document.createEvent("Event");
25 ev.initEvent("foo", true, false);
26 testPropagationFlag(ev, true, "Newly-created Event");
27 ev.stopPropagation();
28 testPropagationFlag(ev, false, "After stopPropagation()");
29 ev.initEvent("foo", true, false);
30 testPropagationFlag(ev, true, "Reinitialized after stopPropagation()");
31
32 var ev = document.createEvent("Event");
33 ev.initEvent("foo", true, false);
34 ev.stopImmediatePropagation();
35 testPropagationFlag(ev, false, "After stopImmediatePropagation()");
36 ev.initEvent("foo", true, false);
37 testPropagationFlag(ev, true, "Reinitialized after stopImmediatePropagation()");
38 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698