-
Notifications
You must be signed in to change notification settings - Fork 317
Set event.target to null when dispatching finishes at ShadowRoot #513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@annevk @hayatoito PTAL |
|
This should be accompanied with a corresponding layout test - will be created as a separate PR for WPT repository. |
dom.bs
Outdated
| <li><p>Set <var>event</var>'s {{Event/eventPhase}} attribute to {{Event/NONE}}. | ||
|
|
||
| <li><p>Set <var>event</var>'s {{Event/target}} attribute to null if {{Event/target}}'s root is a | ||
| <a for=/>shadow root</a> and <var>event</var>'s <a>composed flag</a> is unset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and event's composed flag is unset.
We should remove this condition.
We need to clear event.target even if composed flag is set because target and relatedTarget can be identical in the middle and event path can be trimmed for that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. So we can determine if the event is stopped at shadow root just by looking at whether target's root is a shadow root.
Yeah, I am happy to review PR for WPT too. |
annevk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I'll land this when we have the WPT PR. It would also be good to file browser bugs against Chrome and WebKit. Neither Edge nor Firefox has an implementation at the moment so that seems less needed.
c25dc11 to
f71afca
Compare
|
@hayatoito @annevk PTAL for Also, the corresponding WPT pull request is at |
|
@TakayoshiKochi I don't quite know how |
|
Also, is currentTarget affected? |
dom.bs
Outdated
|
|
||
| <li><p>Set <var>event</var>'s {{Event/eventPhase}} attribute to {{Event/NONE}}. | ||
|
|
||
| <li><p>Set <var>event</var>'s {{Event/target}} attribute to null if {{Event/target}}'s root is a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should link "root" here and below as well.
With the status quo, if an event bubbling ends up at a shadow root, its On the other hand, once So I'm in favor of your idea, to set both to null if either condition is true.
|
If either condition is met, set target and relatedTarget to null.
|
Given what you're saying there, we only have to check target, right? Since relatedTarget is either equal or exposes less. |
Absolutely. Thanks for pointing out. |
|
Thanks, my last change request is to put the condition first. "If X, then set Y to Z." is generally how we write these steps. Given there's tests I think this is ready to merge then. Thanks a lot! |
dom.bs
Outdated
|
|
||
| <li><p>Set <var>event</var>'s {{Event/eventPhase}} attribute to {{Event/NONE}}. | ||
|
|
||
| <li><p>If {{Event/target}}'s <a for=tree>root</a> is a <a for=/>shadow root</a>, set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then set*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done.
Will add a test case there for relatedTarget is in document tree while target is in shadow tree and event stops at shadow root to make sure both are set to null.
|
LGTM |
This corresponds to the DOM spec change whatwg/dom#513 not to leak elements inside shadow tree after event dispatch is complete. Bug: 771580, 762829 Change-Id: Ib77b4475c2c5bf174a6bcf3dc9f4dff583fd7d2a
This corresponds to the DOM spec change whatwg/dom#513 not to leak elements inside shadow tree after event dispatch is complete. Bug: 771580, 762829 Change-Id: Ib77b4475c2c5bf174a6bcf3dc9f4dff583fd7d2a Reviewed-on: https://chromium-review.googlesource.com/681894 Commit-Queue: Eriko Kurimoto <[email protected]> Reviewed-by: Takayoshi Kochi <[email protected]> Cr-Commit-Position: refs/heads/master@{#507013}
This corresponds to the DOM spec change whatwg/dom#513 not to leak elements inside shadow tree after event dispatch is complete. Bug: 771580, 762829 Change-Id: Ib77b4475c2c5bf174a6bcf3dc9f4dff583fd7d2a Reviewed-on: https://chromium-review.googlesource.com/681894 Commit-Queue: Eriko Kurimoto <[email protected]> Reviewed-by: Takayoshi Kochi <[email protected]> Cr-Commit-Position: refs/heads/master@{#507013}
This corresponds to the DOM spec change whatwg/dom#513 not to leak elements inside shadow tree after event dispatch is complete. Bug: 771580, 762829 Change-Id: Ib77b4475c2c5bf174a6bcf3dc9f4dff583fd7d2a Reviewed-on: https://chromium-review.googlesource.com/681894 Commit-Queue: Eriko Kurimoto <[email protected]> Reviewed-by: Takayoshi Kochi <[email protected]> Cr-Commit-Position: refs/heads/master@{#507013}
This corresponds to the DOM spec change whatwg/dom#513 not to leak elements inside shadow tree after event dispatch is complete. Bug: 771580, 762829 Change-Id: Ib77b4475c2c5bf174a6bcf3dc9f4dff583fd7d2a Reviewed-on: https://chromium-review.googlesource.com/681894 Commit-Queue: Eriko Kurimoto <[email protected]> Reviewed-by: Takayoshi Kochi <[email protected]> Cr-Commit-Position: refs/heads/master@{#507013}
This corresponds to the DOM spec change whatwg/dom#513 not to leak elements inside shadow tree after event dispatch is complete. Bug: 771580, 762829 Change-Id: Ib77b4475c2c5bf174a6bcf3dc9f4dff583fd7d2a Reviewed-on: https://chromium-review.googlesource.com/681894 Commit-Queue: Eriko Kurimoto <[email protected]> Reviewed-by: Takayoshi Kochi <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#507013} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 9c1d91c2ce388ffd5bfb0c005cd1c9f7016c7e3a
Resolves #511.
Preview | Diff