Bug 206374 - Non-composed CustomEvent's target property is not retargeted to null
Summary: Non-composed CustomEvent's target property is not retargeted to null
Status: RESOLVED DUPLICATE of bug 218638
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 13
Hardware: Mac macOS 10.14
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 148695
  Show dependency treegraph
 
Reported: 2020-01-16 14:20 PST by Ravi Jayaramappa
Modified: 2020-11-09 08:48 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ravi Jayaramappa 2020-01-16 14:20:07 PST
When a non-composed CustomEvent is dispatched inside a shadow tree and the event finishes processing, the event's target is expected to be null. Instead, the event's target is pointing to the element on which it was dispatched. This behavior differs from the other browsers, where the event target is null.

Repro steps:

1. Construct a DOM tree of this form
<div>
   #shadow-root (open)
     <span></span>
</div>

2. Dispatch an event on span element and access the event's target property
const event = new CustomEvent('test', { bubbles: true });
span.dispatchEvent(event);
console.log(event.eventPhase); // 0
console.log(event.target); // <span> in Safari; null in Chrome, Firefox, Edge;

jsbin repro
https://jsbin.com/likekis/edit?html,js,console
Comment 1 Ravi Jayaramappa 2020-01-17 11:14:20 PST
Found the relevant web platform tests to be failing. https://wpt.fyi/results/shadow-dom/event-post-dispatch.html?label=experimental&label=master&aligned
Comment 2 Radar WebKit Bug Importer 2020-01-17 23:28:12 PST
<rdar://problem/58706920>
Comment 3 Chris Dumez 2020-11-09 08:48:44 PST

*** This bug has been marked as a duplicate of bug 218638 ***