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 28564 - [Shadow]: Event model
Summary: [Shadow]: Event model
Status: RESOLVED MOVED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on: 20017 20247 23887 25458 26892 28558 28560
Blocks: 28552
  Show dependency treegraph
 
Reported: 2015-04-27 08:26 UTC by Anne
Modified: 2015-05-27 03:11 UTC (History)
4 users (show)

See Also:


Attachments

Description Anne 2015-04-27 08:26:48 UTC
This is a bug to figure out the overall changes needed to the DOM event dispatch algorithm for shadow DOM.
Comment 1 Anne 2015-04-27 08:58:43 UTC
So we need to modify event dispatch as follows:

* Add a flag to restrict dispatch to the current tree (needed e.g. for <img>'s load and error events)
* Calculate relatedTarget (might affect composed path)
* Calculate the composed path based on relatedTarget, the aforementioned flag, ...

Then listener invocation needs these changes:

* Modify target, currentTarget, relatedTarget, offsetX/Y, Touch#target to be relative
* Modify deepPath to exclude hidden/isolated trees

And we should consider exposing these members:

* path (excludes all shadow trees)
* deepTarget (deepPath[0])
* deepRelatedTarget (not available right now)
* deepOffsetX/Y (not available right now)
* Touch#deepTarget (not available right now)

(It seems a little bit unfortunate that we need to special case certain UI events in the generic event dispatch algorithm. Perhaps we can find a way for the UI Events specification to tackle the relatedTarget needs and such.)
Comment 2 Anne 2015-04-27 13:16:31 UTC
Note that if we add a flag for event dispatch we should also add that flag to dispatchEvent():

  obj.dispatchEvent(ev, { scope: "subtree" })
Comment 3 Olli Pettay 2015-04-27 16:34:44 UTC
We don't need to do everything at once, like that 
obj.dispatchEvent(ev, { scope: "subtree" }) can be added if someone actually
needs it.
The current Shadow DOM and XBL have lived just fine without it.

We don't want shorthand for deepPath[0], I think. So not that kind of deepTarget.
And for relatedTarget there could be also a list, not deepRelatedTarget.
Comment 4 Anne 2015-04-27 16:45:48 UTC
(In reply to Olli Pettay from comment #3)
> The current Shadow DOM and XBL have lived just fine without it.

Not really, see bug 20247 for which it is meant. I guess we don't need to expose the API to JavaScript directly, but we do need the feature.
Comment 5 Olli Pettay 2015-04-27 16:51:16 UTC
Sure, Events need that flag, but it doesn't need to be exposed in any way to scripts, unless needed.
(Though, I'm not really against that, but just hoping that we don't add such features to the platform that no one will use.)
Comment 6 Hayato Ito 2015-05-27 03:11:05 UTC
Moved to Moved to https://github.com/w3c/webcomponents/issues/77