summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/uievents/legacy-domevents-tests/approved/stopPropagation.deferred.effect.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/uievents/legacy-domevents-tests/approved/stopPropagation.deferred.effect.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/uievents/legacy-domevents-tests/approved/stopPropagation.deferred.effect.html')
-rw-r--r--testing/web-platform/tests/uievents/legacy-domevents-tests/approved/stopPropagation.deferred.effect.html70
1 files changed, 70 insertions, 0 deletions
diff --git a/testing/web-platform/tests/uievents/legacy-domevents-tests/approved/stopPropagation.deferred.effect.html b/testing/web-platform/tests/uievents/legacy-domevents-tests/approved/stopPropagation.deferred.effect.html
new file mode 100644
index 000000000..93489c63b
--- /dev/null
+++ b/testing/web-platform/tests/uievents/legacy-domevents-tests/approved/stopPropagation.deferred.effect.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title> Event.stopPropagation() deferred effect </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>
+ 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 CurrentTargets = [window, document, HTML, BODY, TABLE, TBODY, PARENT, TARGET];
+ var ExpectResult = [window, window, document, document, HTML, HTML, BODY, BODY, TABLE, TABLE];
+ var ActualResult = [];
+ var ExpectListeners = [0,1,0,1,0,1,0,1,0,1];
+ var ActualListeners = [];
+
+ var description = "Test Description: " +
+ "stopPropagation() prevents other event listeners from being triggered but its effect must be " +
+ "deferred until all event listeners attached on the Event.currentTarget have been triggered.";
+
+ test(function()
+ {
+ for (var i=0; i < CurrentTargets.length; i++)
+ {
+ CurrentTargets[i].addEventListener(EVENT, function(e){TestEvent(e, 0)}, true);
+ CurrentTargets[i].addEventListener(EVENT, function(e){TestEvent(e, 1)}, true);
+ }
+
+ var evt = document.createEvent("Event");
+ evt.initEvent(EVENT, true, true);
+ TARGET.dispatchEvent(evt);
+
+ assert_array_equals(ActualResult, ExpectResult, "ActualResult");
+ assert_array_equals(ActualListeners, ExpectListeners, "ActualListeners");
+
+ }, description);
+
+ function TestEvent(evt, i)
+ {
+ ActualResult.push(evt.currentTarget);
+ ActualListeners.push(i);
+ if ((1 == evt.eventPhase) && (TABLE == evt.currentTarget) && (0 == i))
+ {
+ evt.stopPropagation();
+ }
+ }
+</script>
+</body>
+</html>