Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6029b693424e1779c8827ea9004083e82f7ffb7a
https://github.com/WebKit/WebKit/commit/6029b693424e1779c8827ea9004083e82f7ffb7a
Author: Chris Dumez <[email protected]>
Date: 2026-04-05 (Sun, 05 Apr 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/shadow-dom/event-post-dispatch-no-listeners-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/shadow-dom/event-post-dispatch-no-listeners.html
M Source/WebCore/dom/EventDispatcher.cpp
M Source/WebCore/dom/EventPath.h
Log Message:
-----------
Fix event.target not being set after dispatching in shadow tree with no
listeners
https://bugs.webkit.org/show_bug.cgi?id=311415
Reviewed by Anne van Kesteren.
When dispatching an event on a node inside a shadow tree and there are
no event listeners for that event type in the document, the early-exit
path in EventDispatcher::dispatchEvent failed to call resetBeforeDispatch()
and setTarget(). This left event.target stale (or null) instead of being
set to the retargeted shadow host.
The fix uses the retargeted target from the outermost EventPath context,
which correctly reflects the target after shadow DOM retargeting.
Test:
imported/w3c/web-platform-tests/shadow-dom/event-post-dispatch-no-listeners.html
*
LayoutTests/imported/w3c/web-platform-tests/shadow-dom/event-post-dispatch-no-listeners-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/shadow-dom/event-post-dispatch-no-listeners.html:
Added.
* Source/WebCore/dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchEvent):
* Source/WebCore/dom/EventPath.h:
(WebCore::EventPath::last const):
(WebCore::EventPath::last):
Canonical link: https://commits.webkit.org/310621@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications