Skip to content

Commit 2e90e89

Browse files
hayatoitochromium-wpt-export-bot
authored andcommitted
Don't dispatch synthetic events if target == relatedTarget
Revert the part of https://codereview.chromium.org/2384403002 since the DOM Standard was updated and 'isTrusted' guard condition was removed from there. See the discussion at whatwg/dom#336 for details. Blink forgot to address the update of the commit, as mentioned at whatwg/dom#336 (comment). Bug: 655494 Change-Id: I084cd6b748c304f5f2b395f0b62ba02025385a98
1 parent 93c6598 commit 2e90e89

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

shadow-dom/event-composed-path-with-related-target.html

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@
2525
let n = createTestTree(test1);
2626
let log = dispatchEventWithLog(n, n.target, new FocusEvent('my-focus', { bubbles: true, composed: true, relatedTarget: n.target }));
2727
let path = ['target', 'test1'];
28-
assert_event_path_equals(log, [['target', 'target', 'target', path],
29-
['test1', 'target', 'target', path]]);
30-
}, 'Event path for an event with a relatedTarget. Event should be dispatched even when target and relatedTarget are same.');
28+
assert_array_equals(log, []);
29+
}, 'Event path for an event with a relatedTarget. Event should not be dispatched when target and relatedTarget are same.');
3130
</script>
3231

3332
<div id="test2">
@@ -52,9 +51,8 @@
5251
let n = createTestTree(test2);
5352
let log = dispatchEventWithLog(n, n.target, new FocusEvent('my-focus', { bubbles: true, composed: true, relatedTarget: n.target }));
5453
let path = ['target', 'sr'];
55-
assert_event_path_equals(log, [['target', 'target', 'target', path],
56-
['sr', 'target', 'target', path]]);
57-
}, 'Event path for an event with a relatedTarget which is identical to target. Event should be dispatched and should stop at the shadow root.');
54+
assert_array_equals(log, []);
55+
}, 'Event path for an event with a relatedTarget which is identical to target. Event should not be dispatched.');
5856
</script>
5957

6058
<div id="test3_1">
@@ -137,8 +135,7 @@
137135
let n = createTestTree(test4);
138136
let log = dispatchEventWithLog(n, n.host1, new FocusEvent('my-focus', { bubbles: true, composed: true, relatedTarget: n.target }));
139137
let path = ['host1', 'test4'];
140-
assert_event_path_equals(log, [['host1', 'host1', 'host1', path],
141-
['test4', 'host1', 'host1', path]]);
138+
assert_event_path_equals(log, []);
142139
}, 'Event path for an event with a relatedTarget. target is a shadow-including ancestor of relatedTarget.');
143140
</script>
144141

0 commit comments

Comments
 (0)