summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/events
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/dom/events')
-rw-r--r--testing/web-platform/tests/dom/events/AddEventListenerOptions-once.html81
-rw-r--r--testing/web-platform/tests/dom/events/AddEventListenerOptions-passive.html113
-rw-r--r--testing/web-platform/tests/dom/events/CustomEvent.html19
-rw-r--r--testing/web-platform/tests/dom/events/Event-constants.html23
-rw-r--r--testing/web-platform/tests/dom/events/Event-constructors.html115
-rw-r--r--testing/web-platform/tests/dom/events/Event-defaultPrevented-after-dispatch.html26
-rw-r--r--testing/web-platform/tests/dom/events/Event-defaultPrevented.html42
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-bubbles-false.html98
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-bubbles-true.html108
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-detached-click.html19
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-handlers-changed.html92
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-multiple-stopPropagation.html51
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-omitted-capture.html70
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-order.html26
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-other-document.html22
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-propagation-stopped.html59
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-redispatch.html28
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-reenter.html66
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-target-moved.html73
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-target-removed.html72
-rw-r--r--testing/web-platform/tests/dom/events/Event-dispatch-throwing.html51
-rw-r--r--testing/web-platform/tests/dom/events/Event-init-while-dispatching.html83
-rw-r--r--testing/web-platform/tests/dom/events/Event-initEvent.html118
-rw-r--r--testing/web-platform/tests/dom/events/Event-propagation.html41
-rw-r--r--testing/web-platform/tests/dom/events/Event-subclasses-constructors.html153
-rw-r--r--testing/web-platform/tests/dom/events/Event-type-empty.html35
-rw-r--r--testing/web-platform/tests/dom/events/Event-type.html22
-rw-r--r--testing/web-platform/tests/dom/events/EventListener-handleEvent.html41
-rw-r--r--testing/web-platform/tests/dom/events/EventListener-incumbent-global-1.sub.html20
-rw-r--r--testing/web-platform/tests/dom/events/EventListener-incumbent-global-2.sub.html20
-rw-r--r--testing/web-platform/tests/dom/events/EventListener-incumbent-global-subframe-1.sub.html13
-rw-r--r--testing/web-platform/tests/dom/events/EventListener-incumbent-global-subframe-2.sub.html13
-rw-r--r--testing/web-platform/tests/dom/events/EventListener-incumbent-global-subsubframe.sub.html20
-rw-r--r--testing/web-platform/tests/dom/events/EventListenerOptions-capture.html98
-rw-r--r--testing/web-platform/tests/dom/events/EventTarget-addEventListener.html16
-rw-r--r--testing/web-platform/tests/dom/events/EventTarget-dispatchEvent-returnvalue.html43
-rw-r--r--testing/web-platform/tests/dom/events/EventTarget-dispatchEvent.html104
-rw-r--r--testing/web-platform/tests/dom/events/EventTarget-removeEventListener.html16
-rw-r--r--testing/web-platform/tests/dom/events/ProgressEvent.html25
39 files changed, 0 insertions, 2135 deletions
diff --git a/testing/web-platform/tests/dom/events/AddEventListenerOptions-once.html b/testing/web-platform/tests/dom/events/AddEventListenerOptions-once.html
deleted file mode 100644
index ae750702c..000000000
--- a/testing/web-platform/tests/dom/events/AddEventListenerOptions-once.html
+++ /dev/null
@@ -1,81 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>AddEventListenerOptions.once</title>
-<link rel="author" title="Xidorn Quan" href="https://www.upsuper.org">
-<link rel="help" href="https://dom.spec.whatwg.org/#dom-addeventlisteneroptions-once">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-
-test(function() {
- var invoked_once = false;
- var invoked_normal = false;
- function handler_once() {
- invoked_once = true;
- }
- function handler_normal() {
- invoked_normal = true;
- }
-
- document.addEventListener('test', handler_once, {once: true});
- document.addEventListener('test', handler_normal);
- document.dispatchEvent(new Event('test'));
- assert_equals(invoked_once, true, "Once handler should be invoked");
- assert_equals(invoked_normal, true, "Normal handler should be invoked");
-
- invoked_once = false;
- invoked_normal = false;
- document.dispatchEvent(new Event('test'));
- assert_equals(invoked_once, false, "Once handler shouldn't be invoked again");
- assert_equals(invoked_normal, true, "Normal handler should be invoked again");
- document.removeEventListener('test', handler_normal);
-}, "Once listener should be invoked only once");
-
-test(function() {
- var invoked_count = 0;
- function handler() {
- invoked_count++;
- if (invoked_count == 1)
- document.dispatchEvent(new Event('test'));
- }
- document.addEventListener('test', handler, {once: true});
- document.dispatchEvent(new Event('test'));
- assert_equals(invoked_count, 1, "Once handler should only be invoked once");
-
- invoked_count = 0;
- function handler2() {
- invoked_count++;
- if (invoked_count == 1)
- document.addEventListener('test', handler2, {once: true});
- if (invoked_count <= 2)
- document.dispatchEvent(new Event('test'));
- }
- document.addEventListener('test', handler2, {once: true});
- document.dispatchEvent(new Event('test'));
- assert_equals(invoked_count, 2, "Once handler should only be invoked once after each adding");
-}, "Once listener should be invoked only once even if the event is nested");
-
-test(function() {
- var invoked_count = 0;
- function handler() {
- invoked_count++;
- }
-
- document.addEventListener('test', handler, {once: true});
- document.addEventListener('test', handler);
- document.dispatchEvent(new Event('test'));
- assert_equals(invoked_count, 1, "The handler should only be added once");
-
- invoked_count = 0;
- document.dispatchEvent(new Event('test'));
- assert_equals(invoked_count, 0, "The handler was added as a once listener");
-
- invoked_count = 0;
- document.addEventListener('test', handler, {once: true});
- document.removeEventListener('test', handler);
- document.dispatchEvent(new Event('test'));
- assert_equals(invoked_count, 0, "The handler should have been removed");
-}, "Once listener should be added / removed like normal listeners");
-
-</script>
diff --git a/testing/web-platform/tests/dom/events/AddEventListenerOptions-passive.html b/testing/web-platform/tests/dom/events/AddEventListenerOptions-passive.html
deleted file mode 100644
index 1f0118efa..000000000
--- a/testing/web-platform/tests/dom/events/AddEventListenerOptions-passive.html
+++ /dev/null
@@ -1,113 +0,0 @@
-<!DOCTYPE HTML>
-<meta charset="utf-8">
-<title>EventListenerOptions.passive</title>
-<link rel="author" title="Rick Byers" href="mailto:rbyers@chromium.org">
-<link rel="help" href="https://dom.spec.whatwg.org/#dom-addeventlisteneroptions-passive">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-
-<script>
-
-test(function() {
- var supportsPassive = false;
- var query_options = {
- get passive() {
- supportsPassive = true;
- return false;
- },
- get dummy() {
- assert_unreached("dummy value getter invoked");
- return false;
- }
- };
-
- document.addEventListener('test_event', null, query_options);
- assert_true(supportsPassive, "addEventListener doesn't support the passive option");
-
- supportsPassive = false;
- document.removeEventListener('test_event', null, query_options);
- assert_false(supportsPassive, "removeEventListener supports the passive option when it should not");
-}, "Supports passive option on addEventListener only");
-
-function testPassiveValue(optionsValue, expectedDefaultPrevented) {
- var defaultPrevented = undefined;
- var handler = function handler(e) {
- assert_false(e.defaultPrevented, "Event prematurely marked defaultPrevented");
- e.preventDefault();
- defaultPrevented = e.defaultPrevented;
- }
- document.addEventListener('test', handler, optionsValue);
- var uncanceled = document.body.dispatchEvent(new Event('test', {bubbles: true, cancelable: true}));
-
- assert_equals(defaultPrevented, expectedDefaultPrevented, "Incorrect defaultPrevented for options: " + JSON.stringify(optionsValue));
- assert_equals(uncanceled, !expectedDefaultPrevented, "Incorrect return value from dispatchEvent");
-
- document.removeEventListener('test', handler, optionsValue);
-}
-
-test(function() {
- testPassiveValue(undefined, true);
- testPassiveValue({}, true);
- testPassiveValue({passive: false}, true);
- testPassiveValue({passive: true}, false);
- testPassiveValue({passive: 0}, true);
- testPassiveValue({passive: 1}, false);
-}, "preventDefault should be ignored if-and-only-if the passive option is true");
-
-function testPassiveWithOtherHandlers(optionsValue, expectedDefaultPrevented) {
- var handlerInvoked1 = false;
- var dummyHandler1 = function() {
- handlerInvoked1 = true;
- };
- var handlerInvoked2 = false;
- var dummyHandler2 = function() {
- handlerInvoked2 = true;
- };
-
- document.addEventListener('test', dummyHandler1, {passive:true});
- document.addEventListener('test', dummyHandler2);
-
- testPassiveValue(optionsValue, expectedDefaultPrevented);
-
- assert_true(handlerInvoked1, "Extra passive handler not invoked");
- assert_true(handlerInvoked2, "Extra non-passive handler not invoked");
-
- document.removeEventListener('test', dummyHandler1);
- document.removeEventListener('test', dummyHandler2);
-}
-
-test(function() {
- testPassiveWithOtherHandlers({}, true);
- testPassiveWithOtherHandlers({passive: false}, true);
- testPassiveWithOtherHandlers({passive: true}, false);
-}, "passive behavior of one listener should be unaffeted by the presence of other listeners");
-
-function testOptionEquivalence(optionValue1, optionValue2, expectedEquality) {
- var invocationCount = 0;
- var handler = function handler(e) {
- invocationCount++;
- }
- document.addEventListener('test', handler, optionValue1);
- document.addEventListener('test', handler, optionValue2);
- document.body.dispatchEvent(new Event('test', {bubbles: true}));
- assert_equals(invocationCount, expectedEquality ? 1 : 2, "equivalence of options " +
- JSON.stringify(optionValue1) + " and " + JSON.stringify(optionValue2));
- document.removeEventListener('test', handler, optionValue1);
- document.removeEventListener('test', handler, optionValue2);
-}
-
-test(function() {
- // Sanity check options that should be treated as distinct handlers
- testOptionEquivalence({capture:true}, {capture:false, passive:false}, false);
- testOptionEquivalence({capture:true}, {passive:true}, false);
-
- // Option values that should be treated as equivalent
- testOptionEquivalence({}, {passive:false}, true);
- testOptionEquivalence({passive:true}, {passive:false}, true);
- testOptionEquivalence(undefined, {passive:true}, true);
- testOptionEquivalence({capture: true, passive: false}, {capture: true, passive: true}, true);
-
-}, "Equivalence of option values");
-
-</script>
diff --git a/testing/web-platform/tests/dom/events/CustomEvent.html b/testing/web-platform/tests/dom/events/CustomEvent.html
deleted file mode 100644
index c55d5924b..000000000
--- a/testing/web-platform/tests/dom/events/CustomEvent.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!doctype html>
-<title>CustomEvent</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-test(function() {
- var type = "foo";
-
- var target = document.createElement("div");
- target.addEventListener(type, this.step_func(function(evt) {
- assert_equals(evt.type, type);
- }), true);
-
- var fooEvent = document.createEvent("CustomEvent");
- fooEvent.initEvent(type, true, true);
- target.dispatchEvent(fooEvent);
-});
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-constants.html b/testing/web-platform/tests/dom/events/Event-constants.html
deleted file mode 100644
index 635e9894d..000000000
--- a/testing/web-platform/tests/dom/events/Event-constants.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!doctype html>
-<title>Event constants</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="../constants.js"></script>
-<div id="log"></div>
-<script>
-var objects;
-setup(function() {
- objects = [
- [Event, "Event interface object"],
- [Event.prototype, "Event prototype object"],
- [document.createEvent("Event"), "Event object"],
- [document.createEvent("CustomEvent"), "CustomEvent object"]
- ]
-})
-testConstants(objects, [
- ["NONE", 0],
- ["CAPTURING_PHASE", 1],
- ["AT_TARGET", 2],
- ["BUBBLING_PHASE", 3]
-], "eventPhase")
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-constructors.html b/testing/web-platform/tests/dom/events/Event-constructors.html
deleted file mode 100644
index a3cd3f80c..000000000
--- a/testing/web-platform/tests/dom/events/Event-constructors.html
+++ /dev/null
@@ -1,115 +0,0 @@
-<!doctype html>
-<title>Event constructors</title>
-<script src=/resources/testharness.js></script>
-<script src=/resources/testharnessreport.js></script>
-<div id=log></div>
-<script>
-test(function() {
- assert_throws(new TypeError(), function() {
- new Event()
- })
-})
-test(function() {
- var test_error = { name: "test" }
- assert_throws(test_error, function() {
- new Event({ toString: function() { throw test_error; } })
- })
-})
-test(function() {
- var ev = new Event("")
- assert_equals(ev.type, "")
- assert_equals(ev.target, null)
- assert_equals(ev.currentTarget, null)
- assert_equals(ev.eventPhase, Event.NONE)
- assert_equals(ev.bubbles, false)
- assert_equals(ev.cancelable, false)
- assert_equals(ev.defaultPrevented, false)
- assert_equals(ev.isTrusted, false)
- assert_true(ev.timeStamp > 0)
- assert_true("initEvent" in ev)
-})
-test(function() {
- var ev = new Event("test")
- assert_equals(ev.type, "test")
- assert_equals(ev.target, null)
- assert_equals(ev.currentTarget, null)
- assert_equals(ev.eventPhase, Event.NONE)
- assert_equals(ev.bubbles, false)
- assert_equals(ev.cancelable, false)
- assert_equals(ev.defaultPrevented, false)
- assert_equals(ev.isTrusted, false)
- assert_true(ev.timeStamp > 0)
- assert_true("initEvent" in ev)
-})
-test(function() {
- assert_throws(new TypeError(), function() { Event("test") },
- 'Calling Event constructor without "new" must throw');
-})
-test(function() {
- var ev = new Event("I am an event", { bubbles: true, cancelable: false})
- assert_equals(ev.type, "I am an event")
- assert_equals(ev.bubbles, true)
- assert_equals(ev.cancelable, false)
-})
-test(function() {
- var ev = new Event("@", { bubblesIGNORED: true, cancelable: true})
- assert_equals(ev.type, "@")
- assert_equals(ev.bubbles, false)
- assert_equals(ev.cancelable, true)
-})
-test(function() {
- var ev = new Event("@", { "bubbles\0IGNORED": true, cancelable: true})
- assert_equals(ev.type, "@")
- assert_equals(ev.bubbles, false)
- assert_equals(ev.cancelable, true)
-})
-test(function() {
- var ev = new Event("Xx", { cancelable: true})
- assert_equals(ev.type, "Xx")
- assert_equals(ev.bubbles, false)
- assert_equals(ev.cancelable, true)
-})
-test(function() {
- var ev = new Event("Xx", {})
- assert_equals(ev.type, "Xx")
- assert_equals(ev.bubbles, false)
- assert_equals(ev.cancelable, false)
-})
-test(function() {
- var ev = new Event("Xx", {bubbles: true, cancelable: false, sweet: "x"})
- assert_equals(ev.type, "Xx")
- assert_equals(ev.bubbles, true)
- assert_equals(ev.cancelable, false)
- assert_equals(ev.sweet, undefined)
-})
-test(function() {
- var called = []
- var ev = new Event("Xx", {
- get cancelable() {
- called.push("cancelable")
- return false
- },
- get bubbles() {
- called.push("bubbles")
- return true;
- },
- get sweet() {
- called.push("sweet")
- return "x"
- }
- })
- assert_array_equals(called, ["bubbles", "cancelable"])
- assert_equals(ev.type, "Xx")
- assert_equals(ev.bubbles, true)
- assert_equals(ev.cancelable, false)
- assert_equals(ev.sweet, undefined)
-})
-test(function() {
- var ev = new CustomEvent("$", {detail: 54, sweet: "x", sweet2: "x", cancelable:true})
- assert_equals(ev.type, "$")
- assert_equals(ev.bubbles, false)
- assert_equals(ev.cancelable, true)
- assert_equals(ev.sweet, undefined)
- assert_equals(ev.detail, 54)
-})
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-defaultPrevented-after-dispatch.html b/testing/web-platform/tests/dom/events/Event-defaultPrevented-after-dispatch.html
deleted file mode 100644
index decf7e992..000000000
--- a/testing/web-platform/tests/dom/events/Event-defaultPrevented-after-dispatch.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title>Event.defaultPrevented is not reset after dipatchEvent()</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-</head>
-<body>
-<div id=log></div>
-<input id="target" type="hidden" value=""/>
-<script>
-test(function() {
- var EVENT = "foo";
- var TARGET = document.getElementById("target");
- var evt = document.createEvent("Event");
- evt.initEvent(EVENT, true, true);
-
- TARGET.addEventListener(EVENT, this.step_func(function(e) {
- e.preventDefault();
- assert_true(e.defaultPrevented, "during dispatch");
- }), true);
- TARGET.dispatchEvent(evt);
-
- assert_true(evt.defaultPrevented, "after dispatch");
- assert_equals(evt.target, TARGET);
-});
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-defaultPrevented.html b/testing/web-platform/tests/dom/events/Event-defaultPrevented.html
deleted file mode 100644
index 2a3d171b1..000000000
--- a/testing/web-platform/tests/dom/events/Event-defaultPrevented.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!doctype html>
-<title>Event.defaultPrevented</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-var ev;
-test(function() {
- ev = document.createEvent("Event");
- assert_equals(ev.defaultPrevented, false, "defaultPrevented");
-}, "When an event is created, defaultPrevented should be initialized to false.");
-test(function() {
- ev.initEvent("foo", true, false);
- assert_equals(ev.bubbles, true, "bubbles");
- assert_equals(ev.cancelable, false, "cancelable");
- assert_equals(ev.defaultPrevented, false, "defaultPrevented");
-}, "initEvent should work correctly (not cancelable).");
-test(function() {
- assert_equals(ev.cancelable, false, "cancelable (before)");
- ev.preventDefault();
- assert_equals(ev.cancelable, false, "cancelable (after)");
- assert_equals(ev.defaultPrevented, false, "defaultPrevented");
-}, "preventDefault() should not change defaultPrevented if cancelable is false.");
-test(function() {
- ev.initEvent("foo", true, true);
- assert_equals(ev.bubbles, true, "bubbles");
- assert_equals(ev.cancelable, true, "cancelable");
- assert_equals(ev.defaultPrevented, false, "defaultPrevented");
-}, "initEvent should work correctly (cancelable).");
-test(function() {
- assert_equals(ev.cancelable, true, "cancelable (before)");
- ev.preventDefault();
- assert_equals(ev.cancelable, true, "cancelable (after)");
- assert_equals(ev.defaultPrevented, true, "defaultPrevented");
-}, "preventDefault() should change defaultPrevented if cancelable is true.");
-test(function() {
- ev.initEvent("foo", true, true);
- assert_equals(ev.bubbles, true, "bubbles");
- assert_equals(ev.cancelable, true, "cancelable");
- assert_equals(ev.defaultPrevented, false, "defaultPrevented");
-}, "initEvent should unset defaultPrevented.");
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-bubbles-false.html b/testing/web-platform/tests/dom/events/Event-dispatch-bubbles-false.html
deleted file mode 100644
index 0f43cb027..000000000
--- a/testing/web-platform/tests/dom/events/Event-dispatch-bubbles-false.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title> Event.bubbles attribute is set to false </title>
-<link rel="help" href="https://dom.spec.whatwg.org/#dom-event-initevent">
-<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>
-function targetsForDocumentChain(document) {
- return [
- document,
- document.documentElement,
- document.getElementsByTagName("body")[0],
- document.getElementById("table"),
- document.getElementById("table-body"),
- document.getElementById("parent")
- ];
-}
-
-function testChain(document, targetParents, phases, event_type) {
- var target = document.getElementById("target");
- var targets = targetParents.concat(target);
- var expected_targets = targets.concat(target);
-
- 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, true);
- targets[i].addEventListener(event_type, test_event, false);
- }
-
- var evt = document.createEvent("Event");
- evt.initEvent(event_type, false, true);
-
- target.dispatchEvent(evt);
-
- assert_array_equals(actual_targets, expected_targets, "targets");
- assert_array_equals(actual_phases, phases, "phases");
-}
-
-var phasesForDocumentChain = [
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.AT_TARGET,
- Event.AT_TARGET,
-];
-
-test(function () {
- var chainWithWindow = [window].concat(targetsForDocumentChain(document));
- testChain(
- document, chainWithWindow, [Event.CAPTURING_PHASE].concat(phasesForDocumentChain), "click");
-}, "In window.document with click event");
-
-test(function () {
- testChain(document, targetsForDocumentChain(document), phasesForDocumentChain, "load");
-}, "In window.document with load event")
-
-test(function () {
- var documentClone = document.cloneNode(true);
- testChain(
- documentClone, targetsForDocumentChain(documentClone), phasesForDocumentChain, "click");
-}, "In window.document.cloneNode(true)");
-
-test(function () {
- var newDocument = new Document();
- newDocument.appendChild(document.documentElement.cloneNode(true));
- testChain(
- newDocument, targetsForDocumentChain(newDocument), phasesForDocumentChain, "click");
-}, "In new Document()");
-
-test(function () {
- var HTMLDocument = document.implementation.createHTMLDocument();
- HTMLDocument.body.appendChild(document.getElementById("table").cloneNode(true));
- testChain(
- HTMLDocument, targetsForDocumentChain(HTMLDocument), phasesForDocumentChain, "click");
-}, "In DOMImplementation.createHTMLDocument()");
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-bubbles-true.html b/testing/web-platform/tests/dom/events/Event-dispatch-bubbles-true.html
deleted file mode 100644
index b23605a1e..000000000
--- a/testing/web-platform/tests/dom/events/Event-dispatch-bubbles-true.html
+++ /dev/null
@@ -1,108 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title> Event.bubbles attribute is set to false </title>
-<link rel="help" href="https://dom.spec.whatwg.org/#dom-event-initevent">
-<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>
-function concatReverse(a) {
- return a.concat(a.map(function(x) { return x }).reverse());
-}
-
-function targetsForDocumentChain(document) {
- return [
- document,
- document.documentElement,
- document.getElementsByTagName("body")[0],
- document.getElementById("table"),
- document.getElementById("table-body"),
- document.getElementById("parent")
- ];
-}
-
-function testChain(document, targetParents, phases, event_type) {
- var target = document.getElementById("target");
- var targets = targetParents.concat(target);
- var expected_targets = concatReverse(targets);
-
- 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, true);
- targets[i].addEventListener(event_type, test_event, false);
- }
-
- var evt = document.createEvent("Event");
- evt.initEvent(event_type, true, true);
-
- target.dispatchEvent(evt);
-
- assert_array_equals(actual_targets, expected_targets, "targets");
- assert_array_equals(actual_phases, phases, "phases");
-}
-
-var phasesForDocumentChain = [
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.AT_TARGET,
- Event.AT_TARGET,
- Event.BUBBLING_PHASE,
- Event.BUBBLING_PHASE,
- Event.BUBBLING_PHASE,
- Event.BUBBLING_PHASE,
- Event.BUBBLING_PHASE,
- Event.BUBBLING_PHASE,
-];
-
-test(function () {
- var chainWithWindow = [window].concat(targetsForDocumentChain(document));
- var phases = [Event.CAPTURING_PHASE].concat(phasesForDocumentChain, Event.BUBBLING_PHASE);
- testChain(document, chainWithWindow, phases, "click");
-}, "In window.document with click event");
-
-test(function () {
- testChain(document, targetsForDocumentChain(document), phasesForDocumentChain, "load");
-}, "In window.document with load event")
-
-test(function () {
- var documentClone = document.cloneNode(true);
- testChain(
- documentClone, targetsForDocumentChain(documentClone), phasesForDocumentChain, "click");
-}, "In window.document.cloneNode(true)");
-
-test(function () {
- var newDocument = new Document();
- newDocument.appendChild(document.documentElement.cloneNode(true));
- testChain(
- newDocument, targetsForDocumentChain(newDocument), phasesForDocumentChain, "click");
-}, "In new Document()");
-
-test(function () {
- var HTMLDocument = document.implementation.createHTMLDocument();
- HTMLDocument.body.appendChild(document.getElementById("table").cloneNode(true));
- testChain(
- HTMLDocument, targetsForDocumentChain(HTMLDocument), phasesForDocumentChain, "click");
-}, "In DOMImplementation.createHTMLDocument()");
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-detached-click.html b/testing/web-platform/tests/dom/events/Event-dispatch-detached-click.html
deleted file mode 100644
index 30e15b8e4..000000000
--- a/testing/web-platform/tests/dom/events/Event-dispatch-detached-click.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE html>
-<title>Click event on an element not in the document</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id=log></div>
-<script>
-test(function() {
- var EVENT = "click";
- var TARGET = document.createElement("somerandomelement");
- var t = async_test("Click event can be dispatched to an element that is not in the document.")
- TARGET.addEventListener(EVENT, t.step_func(function(evt) {
- assert_equals(evt.target, TARGET);
- t.done();
- }), true);
- var e = document.createEvent("Event");
- e.initEvent(EVENT, true, true);
- TARGET.dispatchEvent(e);
-});
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-handlers-changed.html b/testing/web-platform/tests/dom/events/Event-dispatch-handlers-changed.html
deleted file mode 100644
index b325d5c5d..000000000
--- a/testing/web-platform/tests/dom/events/Event-dispatch-handlers-changed.html
+++ /dev/null
@@ -1,92 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title> Dispatch additional events inside an event listener </title>
-<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>
-async_test(function() {
- var event_type = "bar";
- var target = document.getElementById("target");
- var parent = document.getElementById("parent");
- var tbody = document.getElementById("table-body");
- var table = document.getElementById("table");
- var body = document.body;
- var html = document.documentElement;
- var targets = [window, document, html, body, table, tbody, parent, target];
- var expected_targets = [
- window,
- document,
- html,
- body,
- table,
- tbody,
- parent,
- target,
- target,
- parent,
- tbody,
- table,
- body,
- html,
- document,
- window
- ];
- var expected_listeners = [0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1];
-
- var actual_targets = [], actual_listeners = [];
- var test_event_function = function(i) {
- return this.step_func(function(evt) {
- actual_targets.push(evt.currentTarget);
- actual_listeners.push(i);
-
- if (evt.eventPhase != evt.BUBBLING_PHASE && evt.currentTarget.foo != 1) {
- evt.currentTarget.removeEventListener(event_type, event_handlers[0], true);
- evt.currentTarget.addEventListener(event_type, event_handlers[2], true);
- evt.currentTarget.foo = 1;
- }
-
- if (evt.eventPhase != evt.CAPTURING_PHASE && evt.currentTarget.foo != 3) {
- evt.currentTarget.removeEventListener(event_type, event_handlers[0], false);
- evt.currentTarget.addEventListener(event_type, event_handlers[3], false);
- evt.currentTarget.foo = 3;
- }
- });
- }.bind(this);
- var event_handlers = [
- test_event_function(0),
- test_event_function(1),
- test_event_function(2),
- test_event_function(3),
- ];
-
- for (var i = 0; i < targets.length; ++i) {
- targets[i].addEventListener(event_type, event_handlers[0], true);
- targets[i].addEventListener(event_type, event_handlers[1], false);
- }
-
- var evt = document.createEvent("Event");
- evt.initEvent(event_type, true, true);
- target.dispatchEvent(evt);
-
- assert_array_equals(actual_targets, expected_targets, "actual_targets");
- assert_array_equals(actual_listeners, expected_listeners, "actual_listeners");
-
- this.done();
-});
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-multiple-stopPropagation.html b/testing/web-platform/tests/dom/events/Event-dispatch-multiple-stopPropagation.html
deleted file mode 100644
index 72644bd86..000000000
--- a/testing/web-platform/tests/dom/events/Event-dispatch-multiple-stopPropagation.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title> Multiple dispatchEvent() and stopPropagation() </title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-</head>
-<body>
-<div id=log></div>
-
-<div id="parent" style="display: none">
- <input id="target" type="hidden" value=""/>
-</div>
-
-<script>
-test(function() {
- var event_type = "foo";
- var target = document.getElementById("target");
- var parent = document.getElementById("parent");
- var actual_result;
- var test_event = function(evt) {
- actual_result.push(evt.currentTarget);
-
- if (parent == evt.currentTarget) {
- evt.stopPropagation();
- }
- };
-
- var evt = document.createEvent("Event");
- evt.initEvent(event_type, true, true);
-
- target.addEventListener(event_type, test_event, false);
- parent.addEventListener(event_type, test_event, false);
- document.addEventListener(event_type, test_event, false);
- window.addEventListener(event_type, test_event, false);
-
- actual_result = [];
- target.dispatchEvent(evt);
- assert_array_equals(actual_result, [target, parent]);
-
- actual_result = [];
- parent.dispatchEvent(evt);
- assert_array_equals(actual_result, [parent]);
-
- actual_result = [];
- document.dispatchEvent(evt);
- assert_array_equals(actual_result, [document, window]);
-});
-</script>
-</body>
-</html>
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
deleted file mode 100644
index 77074d9a3..000000000
--- a/testing/web-platform/tests/dom/events/Event-dispatch-omitted-capture.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!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>
diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-order.html b/testing/web-platform/tests/dom/events/Event-dispatch-order.html
deleted file mode 100644
index ca9443459..000000000
--- a/testing/web-platform/tests/dom/events/Event-dispatch-order.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE html>
-<title>Event phases order</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-async_test(function() {
- document.addEventListener('DOMContentLoaded', this.step_func_done(function() {
- var parent = document.getElementById('parent');
- var child = document.getElementById('child');
-
- var order = [];
-
- parent.addEventListener('click', this.step_func(function(){ order.push(1) }), true);
- child.addEventListener('click', this.step_func(function(){ order.push(2) }), false);
- parent.addEventListener('click', this.step_func(function(){ order.push(3) }), false);
-
- child.dispatchEvent(new Event('click', {bubbles: true}));
-
- assert_array_equals(order, [1, 2, 3]);
- }));
-}, "Event phases order");
-</script>
-<div id="parent">
- <div id="child"></div>
-</div>
diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-other-document.html b/testing/web-platform/tests/dom/events/Event-dispatch-other-document.html
deleted file mode 100644
index 0252a4f7b..000000000
--- a/testing/web-platform/tests/dom/events/Event-dispatch-other-document.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!doctype html>
-<title>Custom event on an element in another document</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id=log></div>
-<script>
-test(function() {
- var doc = document.implementation.createHTMLDocument("Demo");
- var element = doc.createElement("div");
- var called = false;
- element.addEventListener("foo", this.step_func(function(ev) {
- assert_false(called);
- called = true;
- assert_equals(ev.target, element);
- }));
- doc.body.appendChild(element);
-
- var event = new Event("foo");
- element.dispatchEvent(event);
- assert_true(called);
-});
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-propagation-stopped.html b/testing/web-platform/tests/dom/events/Event-dispatch-propagation-stopped.html
deleted file mode 100644
index 889f8cfe1..000000000
--- a/testing/web-platform/tests/dom/events/Event-dispatch-propagation-stopped.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title> Calling stopPropagation() prior to dispatchEvent() </title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-</head>
-<body>
-<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 = "foo";
- var target = document.getElementById("target");
- var parent = document.getElementById("parent");
- var tbody = document.getElementById("table-body");
- var table = document.getElementById("table");
- var body = document.body;
- var html = document.documentElement;
- var current_targets = [window, document, html, body, table, tbody, parent, target];
- var expected_targets = [];
- var actual_targets = [];
- var expected_phases = [];
- var actual_phases = [];
-
- var test_event = function(evt) {
- actual_targets.push(evt.currentTarget);
- actual_phases.push(evt.eventPhase);
- };
-
- for (var i = 0; i < current_targets.length; ++i) {
- current_targets[i].addEventListener(event, test_event, true);
- current_targets[i].addEventListener(event, test_event, false);
- }
-
- var evt = document.createEvent("Event");
- evt.initEvent(event, true, true);
- evt.stopPropagation();
- target.dispatchEvent(evt);
-
- assert_array_equals(actual_targets, expected_targets, "actual_targets");
- assert_array_equals(actual_phases, expected_phases, "actual_phases");
-});
-</script>
-</body>
-</html>
diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-redispatch.html b/testing/web-platform/tests/dom/events/Event-dispatch-redispatch.html
deleted file mode 100644
index 4027587bf..000000000
--- a/testing/web-platform/tests/dom/events/Event-dispatch-redispatch.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<meta charset=urf-8>
-<title>EventTarget#dispatchEvent(): redispatching a native event</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id=log></div>
-<script>
-async_test(function() {
- var event;
- document.addEventListener("DOMContentLoaded", this.step_func(function(e) {
- assert_true(e.isTrusted, "Should be trusted when first handled");
- event = e;
- }), true);
-
- window.onload = this.step_func_done(function() {
- var received = 0;
- var target = document.createElement("span");
- target.addEventListener("DOMContentLoaded", this.step_func(function(e) {
- assert_false(e.isTrusted, "Should not be trusted during redispatching");
- ++received;
- }), true);
- assert_true(event.isTrusted, "Should be trusted before redispatching");
- target.dispatchEvent(event);
- assert_false(event.isTrusted, "Should not be trusted after redispatching");
- assert_equals(received, 1);
- });
-});
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-reenter.html b/testing/web-platform/tests/dom/events/Event-dispatch-reenter.html
deleted file mode 100644
index 71f8517bd..000000000
--- a/testing/web-platform/tests/dom/events/Event-dispatch-reenter.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title> Dispatch additional events inside an event listener </title>
-<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 parent = document.getElementById("parent");
- var tbody = document.getElementById("table-body");
- var table = document.getElementById("table");
- var body = document.body;
- var html = document.documentElement;
- var targets = [window, document, html, body, table, tbody, parent, target];
- var expected_targets = [
- window, document, html, body, table,
- target, parent, tbody,
- table, body, html, document, window,
- tbody, parent, target];
- var actual_targets = [];
- var expected_types = [
- "foo", "foo", "foo", "foo", "foo",
- "bar", "bar", "bar",
- "bar", "bar", "bar", "bar", "bar",
- "foo", "foo", "foo"
- ];
-
- var actual_targets = [], actual_types = [];
- var test_event = this.step_func(function(evt) {
- actual_targets.push(evt.currentTarget);
- actual_types.push(evt.type);
-
- if (table == evt.currentTarget && event_type == evt.type) {
- var e = document.createEvent("Event");
- e.initEvent("bar", true, true);
- target.dispatchEvent(e);
- }
- });
-
- for (var i = 0; i < targets.length; ++i) {
- targets[i].addEventListener(event_type, test_event, true);
- targets[i].addEventListener("bar", test_event, false);
- }
-
- var evt = document.createEvent("Event");
- evt.initEvent(event_type, false, true);
- target.dispatchEvent(evt);
-
- assert_array_equals(actual_targets, expected_targets, "actual_targets");
- assert_array_equals(actual_types, expected_types, "actual_types");
-});
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-target-moved.html b/testing/web-platform/tests/dom/events/Event-dispatch-target-moved.html
deleted file mode 100644
index facb2c7b9..000000000
--- a/testing/web-platform/tests/dom/events/Event-dispatch-target-moved.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title> Determined event propagation path - target moved </title>
-<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 parent = document.getElementById("parent");
- var tbody = document.getElementById("table-body");
- var table = document.getElementById("table");
- var body = document.body;
- var html = document.documentElement;
- var targets = [window, document, html, body, table, tbody, parent, target];
- var expected_targets = targets.concat([target, parent, tbody, table, body, html, document, window]);
- var phases = [
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.AT_TARGET,
- 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 = this.step_func(function(evt) {
- if (parent === target.parentNode) {
- var table_row = document.getElementById("table-row");
- table_row.appendChild(parent.removeChild(target));
- }
-
- 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, true);
- targets[i].addEventListener(event_type, test_event, false);
- }
-
- var evt = document.createEvent("Event");
- evt.initEvent(event_type, true, true);
- target.dispatchEvent(evt);
-
- assert_array_equals(actual_targets, expected_targets, "targets");
- assert_array_equals(actual_phases, phases, "phases");
-}, "Event propagation path when an element in it is moved within the DOM");
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-target-removed.html b/testing/web-platform/tests/dom/events/Event-dispatch-target-removed.html
deleted file mode 100644
index 531799c3a..000000000
--- a/testing/web-platform/tests/dom/events/Event-dispatch-target-removed.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title>Determined event propagation path - target removed</title>
-<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 parent = document.getElementById("parent");
- var tbody = document.getElementById("table-body");
- var table = document.getElementById("table");
- var body = document.body;
- var html = document.documentElement;
- var targets = [window, document, html, body, table, tbody, parent, target];
- var expected_targets = targets.concat([target, parent, tbody, table, body, html, document, window]);
- var phases = [
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.AT_TARGET,
- 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 = this.step_func(function(evt) {
- if (parent === target.parentNode) {
- parent.removeChild(target);
- }
-
- 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, true);
- targets[i].addEventListener(event_type, test_event, false);
- }
-
- var evt = document.createEvent("Event");
- evt.initEvent(event_type, true, true);
- target.dispatchEvent(evt);
-
- assert_array_equals(actual_targets, expected_targets, "targets");
- assert_array_equals(actual_phases, phases, "phases");
-}, "Event propagation path when an element in it is removed from the DOM");
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-throwing.html b/testing/web-platform/tests/dom/events/Event-dispatch-throwing.html
deleted file mode 100644
index 7d1c0d94a..000000000
--- a/testing/web-platform/tests/dom/events/Event-dispatch-throwing.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<meta charset="UTF-8">
-<title>Throwing in event listeners</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-setup({allow_uncaught_exception:true})
-
-test(function() {
- var errorEvents = 0;
- window.onerror = this.step_func(function(e) {
- assert_equals(typeof e, 'string');
- ++errorEvents;
- });
-
- var element = document.createElement('div');
-
- element.addEventListener('click', function() {
- throw new Error('Error from only listener');
- });
-
- element.dispatchEvent(new Event('click'));
-
- assert_equals(errorEvents, 1);
-}, "Throwing in event listener with a single listeners");
-
-test(function() {
- var errorEvents = 0;
- window.onerror = this.step_func(function(e) {
- assert_equals(typeof e, 'string');
- ++errorEvents;
- });
-
- var element = document.createElement('div');
-
- var secondCalled = false;
-
- element.addEventListener('click', function() {
- throw new Error('Error from first listener');
- });
- element.addEventListener('click', this.step_func(function() {
- secondCalled = true;
- }), false);
-
- element.dispatchEvent(new Event('click'));
-
- assert_equals(errorEvents, 1);
- assert_true(secondCalled);
-}, "Throwing in event listener with multiple listeners");
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-init-while-dispatching.html b/testing/web-platform/tests/dom/events/Event-init-while-dispatching.html
deleted file mode 100644
index 2aa1f6701..000000000
--- a/testing/web-platform/tests/dom/events/Event-init-while-dispatching.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>Re-initializing events while dispatching them</title>
-<link rel="author" title="Josh Matthews" href="mailto:josh@joshmatthews.net">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-var events = {
- 'KeyboardEvent': {
- 'constructor': function() { return new KeyboardEvent("type", {key: "A"}); },
- 'init': function(ev) { ev.initKeyboardEvent("type2", true, true, null, "a", 1, "", true, "") },
- 'check': function(ev) {
- assert_equals(ev.key, "A", "initKeyboardEvent key setter should short-circuit");
- assert_false(ev.repeat, "initKeyboardEvent repeat setter should short-circuit");
- assert_equals(ev.location, 0, "initKeyboardEvent location setter should short-circuit");
- }
- },
- 'MouseEvent': {
- 'constructor': function() { return new MouseEvent("type"); },
- 'init': function(ev) { ev.initMouseEvent("type2", true, true, null, 0, 1, 1, 1, 1, true, true, true, true, 1, null) },
- 'check': function(ev) {
- assert_equals(ev.screenX, 0, "initMouseEvent screenX setter should short-circuit");
- assert_equals(ev.screenY, 0, "initMouseEvent screenY setter should short-circuit");
- assert_equals(ev.clientX, 0, "initMouseEvent clientX setter should short-circuit");
- assert_equals(ev.clientY, 0, "initMouseEvent clientY setter should short-circuit");
- assert_false(ev.ctrlKey, "initMouseEvent ctrlKey setter should short-circuit");
- assert_false(ev.altKey, "initMouseEvent altKey setter should short-circuit");
- assert_false(ev.shiftKey, "initMouseEvent shiftKey setter should short-circuit");
- assert_false(ev.metaKey, "initMouseEvent metaKey setter should short-circuit");
- assert_equals(ev.button, 0, "initMouseEvent button setter should short-circuit");
- }
- },
- 'CustomEvent': {
- 'constructor': function() { return new CustomEvent("type") },
- 'init': function(ev) { ev.initCustomEvent("type2", true, true, 1) },
- 'check': function(ev) {
- assert_equals(ev.detail, null, "initCustomEvent detail setter should short-circuit");
- }
- },
- 'UIEvent': {
- 'constructor': function() { return new UIEvent("type") },
- 'init': function(ev) { ev.initUIEvent("type2", true, true, window, 1) },
- 'check': function(ev) {
- assert_equals(ev.view, null, "initUIEvent view setter should short-circuit");
- assert_equals(ev.detail, 0, "initUIEvent detail setter should short-circuit");
- }
- },
- 'Event': {
- 'constructor': function() { return new Event("type") },
- 'init': function(ev) { ev.initEvent("type2", true, true) },
- 'check': function(ev) {
- assert_equals(ev.bubbles, false, "initEvent bubbles setter should short-circuit");
- assert_equals(ev.cancelable, false, "initEvent cancelable setter should short-circuit");
- assert_equals(ev.type, "type", "initEvent type setter should short-circuit");
- }
- }
-};
-
-var names = Object.keys(events);
-for (var i = 0; i < names.length; i++) {
- var t = async_test("Calling init" + names[i] + " while dispatching.");
- t.step(function() {
- var e = events[names[i]].constructor();
-
- var target = document.createElement("div")
- target.addEventListener("type", t.step_func(function() {
- events[names[i]].init(e);
-
- var o = e;
- while ((o = Object.getPrototypeOf(o))) {
- if (!(o.constructor.name in events)) {
- break;
- }
- events[o.constructor.name].check(e);
- }
- }), false);
-
- assert_equals(target.dispatchEvent(e), true, "dispatchEvent must return true")
- });
- t.done();
-}
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-initEvent.html b/testing/web-platform/tests/dom/events/Event-initEvent.html
deleted file mode 100644
index 85abdff2f..000000000
--- a/testing/web-platform/tests/dom/events/Event-initEvent.html
+++ /dev/null
@@ -1,118 +0,0 @@
-<!DOCTYPE html>
-<title>Event.initEvent</title>
-<link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-var booleans = [true, false];
-booleans.forEach(function(bubbles) {
- booleans.forEach(function(cancelable) {
- test(function() {
- var e = document.createEvent("Event")
- e.initEvent("type", bubbles, cancelable)
-
- // Step 3.
- // Stop (immediate) propagation flag is tested later
- assert_equals(e.defaultPrevented, false, "defaultPrevented")
- // Step 4.
- assert_equals(e.isTrusted, false, "isTrusted")
- // Step 5.
- assert_equals(e.target, null, "target")
- // Step 6.
- assert_equals(e.type, "type", "type")
- // Step 7.
- assert_equals(e.bubbles, bubbles, "bubbles")
- // Step 8.
- assert_equals(e.cancelable, cancelable, "cancelable")
- }, "Properties of initEvent(type, " + bubbles + ", " + cancelable + ")")
- })
-})
-
-test(function() {
- var e = document.createEvent("Event")
- e.initEvent("type 1", true, false)
- assert_equals(e.type, "type 1", "type (first init)")
- assert_equals(e.bubbles, true, "bubbles (first init)")
- assert_equals(e.cancelable, false, "cancelable (first init)")
-
- e.initEvent("type 2", false, true)
- assert_equals(e.type, "type 2", "type (second init)")
- assert_equals(e.bubbles, false, "bubbles (second init)")
- assert_equals(e.cancelable, true, "cancelable (second init)")
-}, "Calling initEvent multiple times (getting type).")
-
-test(function() {
- // https://bugzilla.mozilla.org/show_bug.cgi?id=998809
- var e = document.createEvent("Event")
- e.initEvent("type 1", true, false)
- assert_equals(e.bubbles, true, "bubbles (first init)")
- assert_equals(e.cancelable, false, "cancelable (first init)")
-
- e.initEvent("type 2", false, true)
- assert_equals(e.type, "type 2", "type (second init)")
- assert_equals(e.bubbles, false, "bubbles (second init)")
- assert_equals(e.cancelable, true, "cancelable (second init)")
-}, "Calling initEvent multiple times (not getting type).")
-
-// Step 2.
-async_test(function() {
- // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17715
-
- var e = document.createEvent("Event")
- e.initEvent("type", false, false)
- assert_equals(e.type, "type", "type (first init)")
- assert_equals(e.bubbles, false, "bubbles (first init)")
- assert_equals(e.cancelable, false, "cancelable (first init)")
-
- var target = document.createElement("div")
- target.addEventListener("type", this.step_func(function() {
- e.initEvent("fail", true, true)
- assert_equals(e.type, "type", "type (second init)")
- assert_equals(e.bubbles, false, "bubbles (second init)")
- assert_equals(e.cancelable, false, "cancelable (second init)")
- }), false)
-
- assert_equals(target.dispatchEvent(e), true, "dispatchEvent must return true")
-
- this.done()
-}, "Calling initEvent must not have an effect during dispatching.")
-
-test(function() {
- var e = document.createEvent("Event")
- e.stopPropagation()
- e.initEvent("type", false, false)
- var target = document.createElement("div")
- var called = false
- target.addEventListener("type", function() { called = true }, false)
- assert_true(target.dispatchEvent(e), "dispatchEvent must return true")
- assert_true(called, "Listener must be called")
-}, "Calling initEvent must unset the stop propagation flag.")
-
-test(function() {
- var e = document.createEvent("Event")
- e.stopImmediatePropagation()
- e.initEvent("type", false, false)
- var target = document.createElement("div")
- var called = false
- target.addEventListener("type", function() { called = true }, false)
- assert_true(target.dispatchEvent(e), "dispatchEvent must return true")
- assert_true(called, "Listener must be called")
-}, "Calling initEvent must unset the stop immediate propagation flag.")
-
-async_test(function() {
- var e = document.createEvent("Event")
- e.initEvent("type", false, false)
-
- var target = document.createElement("div")
- target.addEventListener("type", this.step_func(function() {
- e.initEvent("type2", true, true);
- assert_equals(e.type, "type", "initEvent type setter should short-circuit");
- assert_false(e.bubbles, "initEvent bubbles setter should short-circuit");
- assert_false(e.cancelable, "initEvent cancelable setter should short-circuit");
- }), false)
- assert_equals(target.dispatchEvent(e), true, "dispatchEvent must return true")
-
- this.done()
-}, "Calling initEvent during propagation.")
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-propagation.html b/testing/web-platform/tests/dom/events/Event-propagation.html
deleted file mode 100644
index 459d45c18..000000000
--- a/testing/web-platform/tests/dom/events/Event-propagation.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!doctype html>
-<title>Event propagation tests</title>
-<link rel=author title="Aryeh Gregor" href=ayg@aryeh.name>
-<div id=log></div>
-<script src=/resources/testharness.js></script>
-<script src=/resources/testharnessreport.js></script>
-<script>
-"use strict";
-
-function testPropagationFlag(ev, expected, desc) {
- test(function() {
- var called = false;
- var callback = function() { called = true };
- this.add_cleanup(function() {
- document.head.removeEventListener("foo", callback)
- });
- document.head.addEventListener("foo", callback);
- document.head.dispatchEvent(ev);
- assert_equals(called, expected, "Propagation flag");
- // dispatchEvent resets the propagation flags so it will happily dispatch
- // the event the second time around.
- document.head.dispatchEvent(ev);
- assert_equals(called, true, "Propagation flag after first dispatch");
- }, desc);
-}
-
-var ev = document.createEvent("Event");
-ev.initEvent("foo", true, false);
-testPropagationFlag(ev, true, "Newly-created Event");
-ev.stopPropagation();
-testPropagationFlag(ev, false, "After stopPropagation()");
-ev.initEvent("foo", true, false);
-testPropagationFlag(ev, true, "Reinitialized after stopPropagation()");
-
-var ev = document.createEvent("Event");
-ev.initEvent("foo", true, false);
-ev.stopImmediatePropagation();
-testPropagationFlag(ev, false, "After stopImmediatePropagation()");
-ev.initEvent("foo", true, false);
-testPropagationFlag(ev, true, "Reinitialized after stopImmediatePropagation()");
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-subclasses-constructors.html b/testing/web-platform/tests/dom/events/Event-subclasses-constructors.html
deleted file mode 100644
index 1741b9600..000000000
--- a/testing/web-platform/tests/dom/events/Event-subclasses-constructors.html
+++ /dev/null
@@ -1,153 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>Event constructors</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-function assert_props(iface, event, defaults) {
- assert_true(event instanceof self[iface]);
- expected[iface].properties.forEach(function(p) {
- var property = p[0], value = p[defaults ? 1 : 2];
- assert_true(property in event,
- "Event " + format_value(event) + " should have a " +
- property + " property");
- assert_equals(event[property], value,
- "The value of the " + property + " property should be " +
- format_value(value));
- });
- if ("parent" in expected[iface]) {
- assert_props(expected[iface].parent, event, defaults);
- }
-}
-
-var EventModifierInit = [
- ["ctrlKey", false, true],
- ["shiftKey", false, true],
- ["altKey", false, true],
- ["metaKey", false, true],
-];
-var expected = {
- "Event": {
- "properties": [
- ["bubbles", false, true],
- ["cancelable", false, true],
- ],
- },
-
- "UIEvent": {
- "parent": "Event",
- "properties": [
- ["view", null, window],
- ["detail", 0, 7],
- ],
- },
-
- "FocusEvent": {
- "parent": "UIEvent",
- "properties": [
- ["relatedTarget", null, document],
- ],
- },
-
- "MouseEvent": {
- "parent": "UIEvent",
- "properties": EventModifierInit.concat([
- ["screenX", 0, 40],
- ["screenY", 0, 40],
- ["clientX", 0, 40],
- ["clientY", 0, 40],
- ["button", 0, 40],
- ["buttons", 0, 40],
- ["relatedTarget", null, document],
- ]),
- },
-
- "WheelEvent": {
- "parent": "MouseEvent",
- "properties": [
- ["deltaX", 0.0, 3.1],
- ["deltaY", 0.0, 3.1],
- ["deltaZ", 0.0, 3.1],
- ["deltaMode", 0, 40],
- ],
- },
-
- "KeyboardEvent": {
- "parent": "UIEvent",
- "properties": EventModifierInit.concat([
- ["key", "", "string"],
- ["code", "", "string"],
- ["location", 0, 7],
- ["repeat", false, true],
- ["isComposing", false, true],
- ["charCode", 0, 7],
- ["keyCode", 0, 7],
- ["which", 0, 7],
- ]),
- },
-
- "CompositionEvent": {
- "parent": "UIEvent",
- "properties": [
- ["data", "", "string"],
- ],
- },
-};
-
-Object.keys(expected).forEach(function(iface) {
- test(function() {
- var event = new self[iface]("type");
- assert_props(iface, event, true);
- }, iface + " constructor (no argument)");
-
- test(function() {
- var event = new self[iface]("type", undefined);
- assert_props(iface, event, true);
- }, iface + " constructor (undefined argument)");
-
- test(function() {
- var event = new self[iface]("type", null);
- assert_props(iface, event, true);
- }, iface + " constructor (null argument)");
-
- test(function() {
- var event = new self[iface]("type", {});
- assert_props(iface, event, true);
- }, iface + " constructor (empty argument)");
-
- test(function() {
- var dictionary = {};
- expected[iface].properties.forEach(function(p) {
- var property = p[0], value = p[1];
- dictionary[property] = value;
- });
- var event = new self[iface]("type", dictionary);
- assert_props(iface, event, true);
- }, iface + " constructor (argument with default values)");
-
- test(function() {
- function fill_in(iface, dictionary) {
- if ("parent" in expected[iface]) {
- fill_in(expected[iface].parent, dictionary)
- }
- expected[iface].properties.forEach(function(p) {
- var property = p[0], value = p[2];
- dictionary[property] = value;
- });
- }
-
- var dictionary = {};
- fill_in(iface, dictionary);
-
- var event = new self[iface]("type", dictionary);
- assert_props(iface, event, false);
- }, iface + " constructor (argument with non-default values)");
-});
-
-test(function () {
- assert_throws(new TypeError(), function() {
- new UIEvent("x", { view: 7 })
- });
-}, "UIEvent constructor (view argument with wrong type)")
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-type-empty.html b/testing/web-platform/tests/dom/events/Event-type-empty.html
deleted file mode 100644
index 225b85a61..000000000
--- a/testing/web-platform/tests/dom/events/Event-type-empty.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<title>Event.type set to the empty string</title>
-<link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com">
-<link rel="help" href="https://dom.spec.whatwg.org/#dom-event-type">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-function do_test(t, e) {
- assert_equals(e.type, "", "type");
- assert_equals(e.bubbles, false, "bubbles");
- assert_equals(e.cancelable, false, "cancelable");
-
- var target = document.createElement("div");
- var handled = false;
- target.addEventListener("", t.step_func(function(e) {
- handled = true;
- }));
- assert_true(target.dispatchEvent(e));
- assert_true(handled);
-}
-
-async_test(function() {
- var e = document.createEvent("Event");
- e.initEvent("", false, false);
- do_test(this, e);
- this.done();
-}, "initEvent");
-
-async_test(function() {
- var e = new Event("");
- do_test(this, e);
- this.done();
-}, "Constructor");
-</script>
diff --git a/testing/web-platform/tests/dom/events/Event-type.html b/testing/web-platform/tests/dom/events/Event-type.html
deleted file mode 100644
index 22792f5c6..000000000
--- a/testing/web-platform/tests/dom/events/Event-type.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE html>
-<title>Event.type</title>
-<link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com">
-<link rel="help" href="https://dom.spec.whatwg.org/#dom-event-type">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-test(function() {
- var e = document.createEvent("Event")
- assert_equals(e.type, "");
-}, "Event.type should initially be the empty string");
-test(function() {
- var e = document.createEvent("Event")
- e.initEvent("foo", false, false)
- assert_equals(e.type, "foo")
-}, "Event.type should be initialized by initEvent");
-test(function() {
- var e = new Event("bar")
- assert_equals(e.type, "bar")
-}, "Event.type should be initialized by the constructor");
-</script>
diff --git a/testing/web-platform/tests/dom/events/EventListener-handleEvent.html b/testing/web-platform/tests/dom/events/EventListener-handleEvent.html
deleted file mode 100644
index 3b58c4969..000000000
--- a/testing/web-platform/tests/dom/events/EventListener-handleEvent.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title>EventListener::handleEvent()</title>
-<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(t) {
- var event = "foo";
- var target = document.getElementById("target");
-
- var event_listener = {
- "handleEvent": function(evt) {
- var that = this;
- t.step(function() {
- assert_equals(evt.type, event);
- assert_equals(evt.target, target);
- assert_equals(that, event_listener);
- });
- }
- };
-
- var evt = document.createEvent("Event");
- evt.initEvent(event, true, true);
-
- target.addEventListener(event, event_listener, true);
- target.dispatchEvent(evt);
-});
-</script>
diff --git a/testing/web-platform/tests/dom/events/EventListener-incumbent-global-1.sub.html b/testing/web-platform/tests/dom/events/EventListener-incumbent-global-1.sub.html
deleted file mode 100644
index 9d941385c..000000000
--- a/testing/web-platform/tests/dom/events/EventListener-incumbent-global-1.sub.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!doctype html>
-<meta charset=utf-8>
-<title></title>
-<script src=/resources/testharness.js></script>
-<script src=/resources/testharnessreport.js></script>
-<iframe src="{{location[scheme]}}://{{domains[www1]}}:{{ports[http][0]}}{{location[path]}}/../EventListener-incumbent-global-subframe-1.sub.html"></iframe>
-<script>
-
-var t = async_test("Check the incumbent global EventListeners are called with");
-
-onload = t.step_func(function() {
- onmessage = t.step_func_done(function(e) {
- var d = e.data;
- assert_equals(d.actual, d.expected, d.reason);
- });
-
- frames[0].postMessage("start", "*");
-});
-
-</script>
diff --git a/testing/web-platform/tests/dom/events/EventListener-incumbent-global-2.sub.html b/testing/web-platform/tests/dom/events/EventListener-incumbent-global-2.sub.html
deleted file mode 100644
index 4433c098d..000000000
--- a/testing/web-platform/tests/dom/events/EventListener-incumbent-global-2.sub.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!doctype html>
-<meta charset=utf-8>
-<title></title>
-<script src=/resources/testharness.js></script>
-<script src=/resources/testharnessreport.js></script>
-<iframe src="{{location[scheme]}}://{{domains[www1]}}:{{ports[http][0]}}{{location[path]}}/../EventListener-incumbent-global-subframe-2.sub.html"></iframe>
-<script>
-
-var t = async_test("Check the incumbent global EventListeners are called with");
-
-onload = t.step_func(function() {
- onmessage = t.step_func_done(function(e) {
- var d = e.data;
- assert_equals(d.actual, d.expected, d.reason);
- });
-
- frames[0].postMessage("start", "*");
-});
-
-</script>
diff --git a/testing/web-platform/tests/dom/events/EventListener-incumbent-global-subframe-1.sub.html b/testing/web-platform/tests/dom/events/EventListener-incumbent-global-subframe-1.sub.html
deleted file mode 100644
index 25487cc5e..000000000
--- a/testing/web-platform/tests/dom/events/EventListener-incumbent-global-subframe-1.sub.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<iframe src="{{location[scheme]}}://{{domains[www2]}}:{{ports[http][0]}}{{location[path]}}/../EventListener-incumbent-global-subsubframe.sub.html"></iframe>
-<script>
- document.domain = "{{host}}";
- onmessage = function(e) {
- if (e.data == "start") {
- frames[0].document.body.addEventListener("click", frames[0].postMessage.bind(frames[0], "respond", "*", undefined));
- frames[0].postMessage("sendclick", "*");
- } else {
- parent.postMessage(e.data, "*");
- }
- }
-</script>
diff --git a/testing/web-platform/tests/dom/events/EventListener-incumbent-global-subframe-2.sub.html b/testing/web-platform/tests/dom/events/EventListener-incumbent-global-subframe-2.sub.html
deleted file mode 100644
index 9c7235e2a..000000000
--- a/testing/web-platform/tests/dom/events/EventListener-incumbent-global-subframe-2.sub.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<iframe src="{{location[scheme]}}://{{domains[www2]}}:{{ports[http][0]}}{{location[path]}}/../EventListener-incumbent-global-subsubframe.sub.html"></iframe>
-<script>
- document.domain = "{{host}}";
- onmessage = function(e) {
- if (e.data == "start") {
- frames[0].document.body.addEventListener("click", frames[0].getTheListener());
- frames[0].postMessage("sendclick", "*");
- } else {
- parent.postMessage(e.data, "*");
- }
- }
-</script>
diff --git a/testing/web-platform/tests/dom/events/EventListener-incumbent-global-subsubframe.sub.html b/testing/web-platform/tests/dom/events/EventListener-incumbent-global-subsubframe.sub.html
deleted file mode 100644
index 9ce9f21ca..000000000
--- a/testing/web-platform/tests/dom/events/EventListener-incumbent-global-subsubframe.sub.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<script>
- function getTheListener() {
- return postMessage.bind(this, "respond", "*", undefined)
- }
- document.domain = "{{host}}";
- onmessage = function (e) {
- if (e.data == "sendclick") {
- document.body.click();
- } else {
- parent.postMessage(
- {
- actual: e.origin,
- expected: "{{location[scheme]}}://{{domains[www1]}}:{{ports[http][0]}}",
- reason: "Incumbent should have been the caller of addEventListener()"
- },
- "*")
- };
- }
-</script>
diff --git a/testing/web-platform/tests/dom/events/EventListenerOptions-capture.html b/testing/web-platform/tests/dom/events/EventListenerOptions-capture.html
deleted file mode 100644
index f72cf3ca5..000000000
--- a/testing/web-platform/tests/dom/events/EventListenerOptions-capture.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE HTML>
-<meta charset="utf-8">
-<title>EventListenerOptions.capture</title>
-<link rel="author" title="Rick Byers" href="mailto:rbyers@chromium.org">
-<link rel="help" href="https://dom.spec.whatwg.org/#dom-eventlisteneroptions-capture">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-
-<script>
-
-function testCaptureValue(captureValue, expectedValue) {
- var handlerPhase = undefined;
- var handler = function handler(e) {
- assert_equals(handlerPhase, undefined, "Handler invoked after remove");
- handlerPhase = e.eventPhase;
- }
- document.addEventListener('test', handler, captureValue);
- document.body.dispatchEvent(new Event('test', {bubbles: true}));
- document.removeEventListener('test', handler, captureValue);
- document.body.dispatchEvent(new Event('test', {bubbles: true}));
- assert_equals(handlerPhase, expectedValue, "Incorrect event phase for value: " + JSON.stringify(captureValue));
-}
-
-test(function() {
- testCaptureValue(true, Event.CAPTURING_PHASE);
- testCaptureValue(false, Event.BUBBLING_PHASE);
- testCaptureValue(null, Event.BUBBLING_PHASE);
- testCaptureValue(undefined, Event.BUBBLING_PHASE);
- testCaptureValue(2.3, Event.CAPTURING_PHASE);
- testCaptureValue(-1000.3, Event.CAPTURING_PHASE);
- testCaptureValue(NaN, Event.BUBBLING_PHASE);
- testCaptureValue(+0.0, Event.BUBBLING_PHASE);
- testCaptureValue(-0.0, Event.BUBBLING_PHASE);
- testCaptureValue("", Event.BUBBLING_PHASE);
- testCaptureValue("AAAA", Event.CAPTURING_PHASE);
-}, "Capture boolean should be honored correctly");
-
-test(function() {
- testCaptureValue({}, Event.BUBBLING_PHASE);
- testCaptureValue({capture:true}, Event.CAPTURING_PHASE);
- testCaptureValue({capture:false}, Event.BUBBLING_PHASE);
- testCaptureValue({capture:2}, Event.CAPTURING_PHASE);
- testCaptureValue({capture:0}, Event.BUBBLING_PHASE);
-}, "Capture option should be honored correctly");
-
-test(function() {
- var supportsCapture = false;
- var query_options = {
- get capture() {
- supportsCapture = true;
- return false;
- },
- get dummy() {
- assert_unreached("dummy value getter invoked");
- return false;
- }
- };
-
- document.addEventListener('test_event', null, query_options);
- assert_true(supportsCapture, "addEventListener doesn't support the capture option");
- supportsCapture = false;
- document.removeEventListener('test_event', null, query_options);
- assert_true(supportsCapture, "removeEventListener doesn't support the capture option");
-}, "Supports capture option");
-
-function testOptionEquality(addOptionValue, removeOptionValue, expectedEquality) {
- var handlerInvoked = false;
- var handler = function handler(e) {
- assert_equals(handlerInvoked, false, "Handler invoked multiple times");
- handlerInvoked = true;
- }
- document.addEventListener('test', handler, addOptionValue);
- document.removeEventListener('test', handler, removeOptionValue);
- document.body.dispatchEvent(new Event('test', {bubbles: true}));
- assert_equals(!handlerInvoked, expectedEquality, "equivalence of options " +
- JSON.stringify(addOptionValue) + " and " + JSON.stringify(removeOptionValue));
- if (handlerInvoked)
- document.removeEventListener('test', handler, addOptionValue);
-}
-
-test(function() {
- // Option values that should be treated as equivalent
- testOptionEquality({}, false, true);
- testOptionEquality({capture: false}, false, true);
- testOptionEquality(true, {capture: true}, true);
- testOptionEquality({capture: null}, undefined, true);
- testOptionEquality({capture: true}, {dummy: false, capture: 1}, true);
- testOptionEquality({dummy: true}, false, true);
-
- // Option values that should be treated as distinct
- testOptionEquality(true, false, false);
- testOptionEquality(true, {capture:false}, false);
- testOptionEquality({}, true, false);
-
-}, "Equivalence of option values");
-
-</script>
diff --git a/testing/web-platform/tests/dom/events/EventTarget-addEventListener.html b/testing/web-platform/tests/dom/events/EventTarget-addEventListener.html
deleted file mode 100644
index e2a46e581..000000000
--- a/testing/web-platform/tests/dom/events/EventTarget-addEventListener.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>EventTarget.addEventListener</title>
-<link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com">
-<link rel="help" href="https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-// Step 1.
-test(function() {
- assert_equals(document.addEventListener("x", null, false), undefined);
- assert_equals(document.addEventListener("x", null, true), undefined);
- assert_equals(document.addEventListener("x", null), undefined);
-}, "Adding a null event listener should succeed");
-</script>
diff --git a/testing/web-platform/tests/dom/events/EventTarget-dispatchEvent-returnvalue.html b/testing/web-platform/tests/dom/events/EventTarget-dispatchEvent-returnvalue.html
deleted file mode 100644
index 8804c38a5..000000000
--- a/testing/web-platform/tests/dom/events/EventTarget-dispatchEvent-returnvalue.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title>EventTarget.dispatchEvent: return value</title>
-<link rel="help" href="https://dom.spec.whatwg.org/#concept-event-dispatch">
-<link rel="help" href="https://dom.spec.whatwg.org/#dom-event-preventdefault">
-<link rel="help" href="https://dom.spec.whatwg.org/#dom-event-defaultprevented">
-<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 parent = document.getElementById("parent");
- var default_prevented;
-
- parent.addEventListener(event_type, function(e) {}, true);
- target.addEventListener(event_type, function(e) {
- evt.preventDefault();
- default_prevented = evt.defaultPrevented;
- }, true);
- target.addEventListener(event_type, function(e) {}, true);
-
- var evt = document.createEvent("Event");
- evt.initEvent(event_type, true, true);
-
- assert_true(parent.dispatchEvent(evt));
- assert_false(target.dispatchEvent(evt));
- assert_true(default_prevented);
-}, "Return value of EventTarget.dispatchEvent.");
-</script>
diff --git a/testing/web-platform/tests/dom/events/EventTarget-dispatchEvent.html b/testing/web-platform/tests/dom/events/EventTarget-dispatchEvent.html
deleted file mode 100644
index 1a8bf3de9..000000000
--- a/testing/web-platform/tests/dom/events/EventTarget-dispatchEvent.html
+++ /dev/null
@@ -1,104 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title>EventTarget.dispatchEvent</title>
-<link rel="author" title="Olli Pettay" href="mailto:Olli.Pettay@gmail.com">
-<link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com">
-<link rel="help" href="https://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="/dom/nodes/Document-createEvent.js"></script>
-<div id="log"></div>
-<script>
-setup({
- "allow_uncaught_exception": true,
-})
-
-test(function() {
- assert_throws(new TypeError(), function() { document.dispatchEvent(null) })
-}, "Calling dispatchEvent(null).")
-
-for (var alias in aliases) {
- test(function() {
- var e = document.createEvent(alias)
- assert_equals(e.type, "", "Event type should be empty string before initialization")
- assert_throws("InvalidStateError", function() { document.dispatchEvent(e) })
- }, "If the event's initialized flag is not set, an InvalidStateError must be thrown (" + alias + ").")
-}
-
-var dispatch_dispatch = async_test("If the event's dispatch flag is set, an InvalidStateError must be thrown.")
-dispatch_dispatch.step(function() {
- var e = document.createEvent("Event")
- e.initEvent("type", false, false)
-
- var target = document.createElement("div")
- target.addEventListener("type", dispatch_dispatch.step_func(function() {
- assert_throws("InvalidStateError", function() {
- target.dispatchEvent(e)
- })
- assert_throws("InvalidStateError", function() {
- document.dispatchEvent(e)
- })
- }), false)
-
- assert_equals(target.dispatchEvent(e), true, "dispatchEvent must return true")
-
- dispatch_dispatch.done()
-})
-
-test(function() {
- // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17713
- // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17714
-
- var e = document.createEvent("Event")
- e.initEvent("type", false, false)
-
- var called = []
-
- var target = document.createElement("div")
- target.addEventListener("type", function() {
- called.push("First")
- throw new Error()
- }, false)
-
- target.addEventListener("type", function() {
- called.push("Second")
- }, false)
-
- assert_equals(target.dispatchEvent(e), true, "dispatchEvent must return true")
- assert_array_equals(called, ["First", "Second"],
- "Should have continued to call other event listeners")
-}, "Exceptions from event listeners must not be propagated.")
-
-async_test(function() {
- var results = []
- var outerb = document.createElement("b")
- var middleb = outerb.appendChild(document.createElement("b"))
- var innerb = middleb.appendChild(document.createElement("b"))
- outerb.addEventListener("x", this.step_func(function() {
- middleb.addEventListener("x", this.step_func(function() {
- results.push("middle")
- }), true)
- results.push("outer")
- }), true)
- innerb.dispatchEvent(new Event("x"))
- assert_array_equals(results, ["outer", "middle"])
- this.done()
-}, "Event listeners added during dispatch should be called");
-
-async_test(function() {
- var results = []
- var b = document.createElement("b")
- b.addEventListener("x", this.step_func(function() {
- results.push(1)
- }), true)
- b.addEventListener("x", this.step_func(function() {
- results.push(2)
- }), false)
- b.addEventListener("x", this.step_func(function() {
- results.push(3)
- }), true)
- b.dispatchEvent(new Event("x"))
- assert_array_equals(results, [1, 2, 3])
- this.done()
-}, "Event listeners should be called in order of addition")
-</script>
diff --git a/testing/web-platform/tests/dom/events/EventTarget-removeEventListener.html b/testing/web-platform/tests/dom/events/EventTarget-removeEventListener.html
deleted file mode 100644
index da2d7db3c..000000000
--- a/testing/web-platform/tests/dom/events/EventTarget-removeEventListener.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>EventTarget.removeEventListener</title>
-<link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com">
-<link rel="help" href="https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-// Step 1.
-test(function() {
- assert_equals(document.removeEventListener("x", null, false), undefined);
- assert_equals(document.removeEventListener("x", null, true), undefined);
- assert_equals(document.removeEventListener("x", null), undefined);
-}, "removing a null event listener should succeed");
-</script>
diff --git a/testing/web-platform/tests/dom/events/ProgressEvent.html b/testing/web-platform/tests/dom/events/ProgressEvent.html
deleted file mode 100644
index aa947e3f2..000000000
--- a/testing/web-platform/tests/dom/events/ProgressEvent.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!doctype html>
-<title>ProgressEvent constructor</title>
-<script src=/resources/testharness.js></script>
-<script src=/resources/testharnessreport.js></script>
-<div id=log></div>
-<script>
-test(function() {
- var ev = new ProgressEvent("test")
- assert_equals(ev.type, "test")
- assert_equals(ev.target, null)
- assert_equals(ev.currentTarget, null)
- assert_equals(ev.eventPhase, Event.NONE)
- assert_equals(ev.bubbles, false)
- assert_equals(ev.cancelable, false)
- assert_equals(ev.defaultPrevented, false)
- assert_equals(ev.isTrusted, false)
- assert_true(ev.timeStamp > 0)
- assert_true("initEvent" in ev)
-}, "Default event values.")
-test(function() {
- var e = document.createEvent("ProgressEvent");
- var eProto = Object.getPrototypeOf(e);
- assert_equals(eProto, ProgressEvent.prototype);
-}, "document.createEvent() should work with ProgressEvent.");
-</script>