summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/events/Event-stopImmediatePropagation.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/dom/events/Event-stopImmediatePropagation.html')
-rw-r--r--testing/web-platform/tests/dom/events/Event-stopImmediatePropagation.html34
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/events/Event-stopImmediatePropagation.html b/testing/web-platform/tests/dom/events/Event-stopImmediatePropagation.html
new file mode 100644
index 0000000000..b75732257a
--- /dev/null
+++ b/testing/web-platform/tests/dom/events/Event-stopImmediatePropagation.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Event's stopImmediatePropagation</title>
+<link rel="help" href="https://dom.spec.whatwg.org/#dom-event-stopimmediatepropagation">
+<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<div id="target"></div>
+
+<script>
+"use strict";
+
+setup({ single_test: true });
+
+const target = document.querySelector("#target");
+
+let timesCalled = 0;
+target.addEventListener("test", e => {
+ ++timesCalled;
+ e.stopImmediatePropagation();
+ assert_equals(e.cancelBubble, true, "The stop propagation flag must have been set");
+});
+target.addEventListener("test", () => {
+ ++timesCalled;
+});
+
+const e = new Event("test");
+target.dispatchEvent(e);
+assert_equals(timesCalled, 1, "The second listener must not have been called");
+
+done();
+</script>