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

Unified Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/Event-dispatch-target-removed.html

Issue 1529523002: Import dom/ from web-platform-tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak W3CImportExpectations Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/Event-dispatch-target-removed.html
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/Event-dispatch-target-removed.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/Event-dispatch-target-removed.html
new file mode 100644
index 0000000000000000000000000000000000000000..fbb81980c74d586bbec959c8316ce4e20aa6e286
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/Event-dispatch-target-removed.html
@@ -0,0 +1,72 @@
+<!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>

Powered by Google App Engine
This is Rietveld 408576698