-
Notifications
You must be signed in to change notification settings - Fork 378
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
deepPath's definition is ambiguous when the event path contains a non-Node EventTarget #432
Comments
In particular, what happens if the path included a If such a situation can arise, I think returning an empty array when the current target is not a |
@annevk @travisleithead : I need your expertise in events. |
Talked with @annevk on IRC. Apparently, hit regions within a canvas element are non-Node event targets, and the event path for them include canvas element and its ancestors, so this is the case for which the current definition is inadequate. My proposal is to find the first Node event target parent from the current event target, and use that to filter nodes. If there are no such target, don't filter anything (e.g. for events on XHR). |
Yeah, the current definition is incorrect in that it talks about nodes. Also, what happens if you dispatch a node in a closed shadow tree that might be retargeted, it would be weird for the event path to only contain nodes of the light tree. |
Yeah, we should consider a case where an event target is not a Node. We should revise the following sentance:
My rough idea is: Give A, an event target in the event path, and B, the current target of EVENT:
Does this sound good?
This is an intentional behavior. Why do you think this is weird? |
Ops. I did not notice this proposal. Let me think about this... |
Okay. Given an event target A (in the event path) and an event target B (as event's current target):
Does this sound good? |
@hayatoito if I have an event listener in a closed shadow tree, should I not get the actual event path? |
You get. The value returned from event.deepPath() depends on the event's currentTarget. In such a case, while the event is being dispatched in the closed shadow tree, event.deepPath() will includes nodes in the closed shadow tree. Once the event gets out of the closed shadow tree, event.deepPath() will not return nodes in the closed shadow tree. |
Okay, that matches my understanding, but in that case the "unclosed node" check seems wrong, since it should only apply to children of a hosted tree, not the current tree or the node's shadow-including inclusive ancestors. |
Do you mean the following is wrong?
Using ANCESTOR-A and ANCESTOR-B sounds bad here?
|
It's not really clear to me how your algorithm works, since there's only one event path. The event path once computed is also a simple list, so we'd have to check if it contains a node I think. We can't talk about ancestors. |
I see. Sorry for the confusion. I should not have used a terminology of an ancestor here. By (inclusive) ANCESTOR, I meant it has a positional index which is less than or equal to A, in the ordered list (which is the event path). |
Still, that doesn't explain how you have two event paths. |
I have clarified it in the spec. |
Since April 4 I learned that hit regions are not implemented yet and we'll likely change their design. Given that, we should probably revert this complexity and note somewhere we would need something like this if we ever mix node and non-node targets. |
Fixes #242. Also reverts WICG/webcomponents#432 as it appears to no longer be needed. If we ever have an event path that starts with a non-node and ends with a node we'll have to add that complexity back. (The reason it is named composedPath() is because deepPath() and various other names were no longer viable after Chrome's initial experiment. See the various issues.)
Fixes #242. Also reverts WICG/webcomponents#432 as it appears to no longer be needed. If we ever have an event path that starts with a non-node and ends with a node we'll have to add that complexity back. (The reason it is named composedPath() is because deepPath() and various other names were no longer viable after Chrome's initial experiment. See the various issues.)
We should clarify what happens when an event is fired on an XHR object, etc... Are we going to include all those items in the path that are not Node? Or does path only contain nodes?
The text was updated successfully, but these errors were encountered: