[whatwg] seamless iframes and event propagation

Anne van Kesteren annevk at annevk.nl
Wed Dec 5 03:16:01 PST 2012

On Wed, Dec 5, 2012 at 11:54 AM, Hayato Ito <hayato at chromium.org> wrote:
> Shadow DOM's event retargeting in WebKit uses one Event object for
> every shadow trees.
> When crossing shadow boundaries, an Event object's target (or
> relatedTarget) is set to the appropriate one, but the event object
> itself is reused.

Interesting. Does Shadow DOM have a concept of events that are private
to the shadow tree or does everything leak?

Also, if you change the target you need to adjust mouse coordinates
and such as well. How does that work? Does that also happens if I
dispatch a synthetic event using dispatchEvent()?

(Not having thought much about it this seems especially hairy for
elements from the ordinary node tree that interleaved via a <content>

But if Shadow DOM shares the Event object we should probably introduce
a flag (e.g. a reuse Event object flag) next to the cross-boundary
event parent pointer.

> There, I created an Event object per frame. You can see the design in
> the ChangeLog of the patch. Please don't take it seriously. It should
> be considered as just an experiment at this stage.
> https://bugs.webkit.org/attachment.cgi?id=168866&action=review

The design Ian and I thought out is the same as far as calculating the
dispatch tree goes and the same as far as what the result would be of
invoking preventDefault() and such.

What seems different is that Ian and I envisioned this to work for all
events. And what seems unclear is what if anything is different
between the clones of the Event object.


More information about the whatwg mailing list