[webcomponents] [Shadow]: Event model (bugzilla: 28564) (#77)

Title: [Shadow]: Event model (bugzilla: 28564)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28564

----
comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28564#c0
*Anne* wrote on 2015-04-27 08:26:48 +0000.

This is a bug to figure out the overall changes needed to the DOM event dispatch algorithm for shadow DOM.

----

comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28564#c1
*Anne* wrote on 2015-04-27 08:58:43 +0000.

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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28564#c2
*Anne* wrote on 2015-04-27 13:16:31 +0000.

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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28564#c3
*Olli Pettay* wrote on 2015-04-27 16:34:44 +0000.

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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28564#c4
*Anne* wrote on 2015-04-27 16:45:48 +0000.

(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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28564#c5
*Olli Pettay* wrote on 2015-04-27 16:51:16 +0000.

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.)

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/77

Received on Monday, 25 May 2015 08:50:04 UTC