Skip to content
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

Non-bubbling event should run non-capture listeners #750

Merged
merged 1 commit into from
Apr 15, 2019

Conversation

annevk
Copy link
Member

@annevk annevk commented Apr 10, 2019

This fixes a regression from #686.

Tests: various tests were failing because of this. web-platform-tests/wpt#16307 aligns the remaining failing test with the new model.

Fixes #742.

This fixes a regression from #686.

Tests: various tests were failing because of this. web-platform-tests/wpt#16307 aligns the remaining failing test with the new model.

Fixes #742.
@domenic
Copy link
Member

domenic commented Apr 10, 2019

@pmdartus and/or @Zirro if you have time to review this it would be appreciated.

@@ -1405,15 +1405,21 @@ for discussion).
</ol>

<li>
<p>If <var>event</var>'s {{Event/bubbles}} attribute is true, then <a for=list>for each</a>
<var>struct</var> in <var>event</var>'s <a for=Event>path</a>:
<p><a for=list>For each</a> <var>struct</var> in <var>event</var>'s <a for=Event>path</a>:

<ol>
<li><p>If <var>struct</var>'s <a for=Event/path>target</a> is non-null, then set
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't get this check. How can target ever be null?
Don't we need to check that target is equal to targetOverride instead?
In general, steps 5.9.7-9 seem to be in the need of a bit more clarification as to what they're trying to do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An event's path consists of a list of structs. target is only non-null for the actual target and any shadow tree hosts that the actual target might be "nested" in.

Copy link
Collaborator

@rniwa rniwa Apr 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that's what this sentence assumes but I don't see how such a condition is met given what's in https://dom.spec.whatwg.org/#concept-event-dispatch. It passes parent as the target of the struct in most cases and each get the parent relies on parent not being null. So I don't see how that's possible...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but that argument is what becomes "item" on the struct, not "target". See https://dom.spec.whatwg.org/#concept-event-path-append. I agree this is somewhat confusing and I'd appreciate if someone could come up with better variable names as I'm still somewhat stuck.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. That is indeed very confusing. Maybe we can use different variable names or something? Having item, target, & targetOverride is confusing enough.

@rniwa
Copy link
Collaborator

rniwa commented Apr 12, 2019

Okay, with that clarification, the change looks good. That's basically what I implemented in WebKit.

@annevk
Copy link
Member Author

annevk commented Apr 12, 2019

I had forgotten that I already got some suggestions in #645. I'll see about fixing that after this.

@rniwa
Copy link
Collaborator

rniwa commented Apr 13, 2019

We can probably merge this fix as is though. We make editorial improvements in #645.

@rniwa
Copy link
Collaborator

rniwa commented Apr 13, 2019

FWIW, I added a test in https://trac.webkit.org/browser/webkit/trunk/LayoutTests/fast/shadow-dom/capturing-and-bubbling-event-listeners-across-shadow-trees.html?rev=236002.

Feel free to create a PR to merge it into WPT. I can make one too if you'd like.

@annevk
Copy link
Member Author

annevk commented Apr 15, 2019

@rniwa if you could turn that into a PR that'd be great, thanks!

@annevk annevk merged commit 98564fc into master Apr 15, 2019
@annevk annevk deleted the annevk/non-bubbling-event-and-non-capture-listener branch April 15, 2019 09:03
@rniwa
Copy link
Collaborator

rniwa commented Apr 15, 2019

@annevk : Ok, posted a PR.

This was referenced Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Composed and non bubbling event semantic dispatched in shadow tree
3 participants