summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/events/Event-dispatch-omitted-capture.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/dom/events/Event-dispatch-omitted-capture.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/dom/events/Event-dispatch-omitted-capture.html')
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-omitted-capture.html70
1 files changed, 70 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-omitted-capture.html b/testing/web-platform/tests/dom/events/Event-dispatch-omitted-capture.html
new file mode 100644
index 000000000..77074d9a3
--- /dev/null
+++ b/testing/web-platform/tests/dom/events/Event-dispatch-omitted-capture.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>EventTarget.addEventListener: capture argument omitted</title>
+<link rel="help" href="https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener">
+<link rel="help" href="https://dom.spec.whatwg.org/#concept-event-dispatch">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<table id="table" border="1" style="display: none">
+ <tbody id="table-body">
+ <tr id="table-row">
+ <td id="table-cell">Shady Grove</td>
+ <td>Aeolian</td>
+ </tr>
+ <tr id="parent">
+ <td id="target">Over the river, Charlie</td>
+ <td>Dorian</td>
+ </tr>
+ </tbody>
+</table>
+<script>
+test(function() {
+ var event_type = "foo";
+ var target = document.getElementById("target");
+ var targets = [
+ target,
+ document.getElementById("parent"),
+ document.getElementById("table-body"),
+ document.getElementById("table"),
+ document.body,
+ document.documentElement,
+ document,
+ window
+ ];
+ var phases = [
+ Event.AT_TARGET,
+ Event.BUBBLING_PHASE,
+ Event.BUBBLING_PHASE,
+ Event.BUBBLING_PHASE,
+ Event.BUBBLING_PHASE,
+ Event.BUBBLING_PHASE,
+ Event.BUBBLING_PHASE,
+ Event.BUBBLING_PHASE
+ ];
+
+ var actual_targets = [], actual_phases = [];
+ var test_event = function(evt) {
+ actual_targets.push(evt.currentTarget);
+ actual_phases.push(evt.eventPhase);
+ }
+
+ for (var i = 0; i < targets.length; i++) {
+ targets[i].addEventListener(event_type, test_event);
+ }
+
+ var evt = document.createEvent("Event");
+ evt.initEvent(event_type, true, true);
+
+ target.dispatchEvent(evt);
+
+ for (var i = 0; i < targets.length; i++) {
+ targets[i].removeEventListener(event_type, test_event);
+ }
+
+ target.dispatchEvent(evt);
+
+ assert_array_equals(actual_targets, targets, "targets");
+ assert_array_equals(actual_phases, phases, "phases");
+}, "EventTarget.addEventListener with the capture argument omitted");
+</script>