window.event should not be affected by nodes moving post-dispatch: - https://dom.spec.whatwg.org/#concept-event-listener-invoke In particular, window.event should not get set when the event target was inside a shadow tree initially when dispatchEvent() got called, even if the event target gets moved out of the shadow tree during the execution of the event listeners.
Created attachment 413355 [details] Patch
Comment on attachment 413355 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=413355&action=review r=me > Source/WebCore/dom/Event.cpp:134 > + m_currentTargetIsInShadowTree = isInShadowTree.valueOr(is<Node>(currentTarget) && downcast<Node>(*currentTarget).isInShadowTree()); Fancy!
Comment on attachment 413355 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=413355&action=review >> Source/WebCore/dom/Event.cpp:134 >> + m_currentTargetIsInShadowTree = isInShadowTree.valueOr(is<Node>(currentTarget) && downcast<Node>(*currentTarget).isInShadowTree()); > > Fancy! Too fancy! The argument to valueOr is going to be computed unconditionally; do we really want that?
(In reply to Darin Adler from comment #3) > Comment on attachment 413355 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=413355&action=review > > >> Source/WebCore/dom/Event.cpp:134 > >> + m_currentTargetIsInShadowTree = isInShadowTree.valueOr(is<Node>(currentTarget) && downcast<Node>(*currentTarget).isInShadowTree()); > > > > Fancy! > > Too fancy! The argument to valueOr is going to be computed unconditionally; > do we really want that? Fair point. Will fix.
Created attachment 413376 [details] Patch
Committed r269500: <https://trac.webkit.org/changeset/269500> All reviewed patches have been landed. Closing bug and clearing flags on attachment 413376 [details].
<rdar://problem/71102768>