This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25423 - [Shadow]: event.path should return every nodes in the event path, instead of erasing nodes on descendant trees.
Summary: [Shadow]: event.path should return every nodes in the event path, instead of ...
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Hayato Ito
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14978
  Show dependency treegraph
 
Reported: 2014-04-23 04:35 UTC by Hayato Ito
Modified: 2014-05-27 11:39 UTC (History)
7 users (show)

See Also:


Attachments

Description Hayato Ito 2014-04-23 04:35:33 UTC
It might be useful that we just expose every nodes in the event path in event.path API, instead of filtering out nodes on descendant trees.
Comment 1 Anne 2014-04-23 09:20:10 UTC
Note that there is another bug on .path open somewhere. It should be able to hold more than nodes.
Comment 2 Hayato Ito 2014-04-23 09:52:39 UTC
(In reply to Anne from comment #1)
> Note that there is another bug on .path open somewhere. It should be able to
> hold more than nodes.

Yep. IIRC, event.path should return an array of *EventTarget*, rather than NodeList.
Comment 3 Anne 2014-04-23 10:27:44 UTC
Correct. Domenic, event.path is another property where we want a "JavaScript Array" solution quickly.
Comment 4 Domenic Denicola 2014-04-23 13:04:16 UTC
I think at the TAG we were fairly strongly on the side of just using normal mutable JavaScript arrays. This shouldn't be hard.
Comment 5 Erik Arvidsson 2014-04-23 13:54:45 UTC
To be clear I thought we also wanted to remove the retargetting that is done on the event path.

Composed tree

    a
    |
    b
    |
  [SR]
    |
    c
    |      
<content>
    |
    d

var calls = 0;
a.addEventListener('click', (e) => {
  assert.deepEqual([a, b, SR, c, content, d], e.path);
  calls++;
});
d.click();
assert.equal(calls, 1);
Comment 6 Anne 2014-04-23 14:32:57 UTC
Erik, if event.path works like that, it does not describe what happens for elements existing today as they hide the shadow tree. Do we really want to leak shadow trees all over the place?
Comment 7 Erik Arvidsson 2014-04-23 14:34:39 UTC
The idea would be to hide those from the path once the spec adds a way to make hidden shadow trees.

In Blink we would of course need to hide our internals for <video> etc even if the spec does not cover this yet.
Comment 8 Anne 2014-04-23 14:40:51 UTC
Hmm. http://w3c.github.io/webcomponents/spec/shadow/#events-that-are-always-stopped is still around too. Those magic lists are bad. How is this shipping without the bugs filed being addressed?
Comment 9 Dimitri Glazkov 2014-04-23 16:17:01 UTC
(In reply to Anne from comment #8)
> Hmm.
> http://w3c.github.io/webcomponents/spec/shadow/#events-that-are-always-
> stopped is still around too. Those magic lists are bad. How is this shipping
> without the bugs filed being addressed?

Not sure what you mean there. There's both a bug for it (https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247) and an explicit item in the plan thing I sent out early this year (http://lists.w3.org/Archives/Public/public-webapps/2014JanMar/0338.html)
Comment 10 Hayato Ito 2014-04-24 07:48:41 UTC
(In reply to Erik Arvidsson from comment #5)
> To be clear I thought we also wanted to remove the retargetting that is done
> on the event path.

This could be filed as another issue.

Could you file another bug? I'd like to see a use case for that there.
Comment 11 Hayato Ito 2014-05-01 07:42:33 UTC
I'd like to move this issue forward.

Can we agree on this?

AFAIR, we have a reason for this change. I appreciate someone would give us a use case for this change in this discussion.
Comment 12 Rafael Weinstein 2014-05-01 17:08:52 UTC
a common pattern of event delegation is to put the delegate (listener) on the document root, but to mark specific nodes in the document which information about what to do with the specific event. When the delegate handles the event, it must inspect the node to retrieve the information (e.g. what method to invoke on the delegate). 

If the event.path is sanitized on it's way up as the event bubbles, in the information the document-wide delegate may need is no longer reachable because it belongs to the a node which has been removed.
Comment 13 Anne 2014-05-02 08:26:33 UTC
However, if shadow tree nodes are just in there, it really isn't much of a "shadow" tree anymore, much more like a real tree. But I guess we lost that when we lost stronger encapsulation...
Comment 14 Dimitri Glazkov 2014-05-02 14:43:35 UTC
(In reply to Anne from comment #13)
> However, if shadow tree nodes are just in there, it really isn't much of a
> "shadow" tree anymore, much more like a real tree. But I guess we lost that
> when we lost stronger encapsulation...

Yup. Let's not forget to erase nodes from event path for "closed" shadow trees.
Comment 15 Hayato Ito 2014-05-07 10:32:48 UTC
Thank you for the comments.

Let me update the spec so that event.path will return every nodes, except for nodes in the *closed descendant trees*.