[whatwg] seamless iframes and event propagation

Hayato Ito hayato at chromium.org
Wed Dec 5 03:37:27 PST 2012

On Wed, Dec 5, 2012 at 8:16 PM, Anne van Kesteren <annevk at annevk.nl> wrote:
> 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?

Some kinds of events should be always stopped at the shadow boundaries.
See http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#events-that-are-always-stopped

> Also, if you change the target you need to adjust mouse coordinates
> and such as well. How does that work?

The Shadow DOM spec does not require adjusting mouse coodinates. I
think every shadow trees in one document *share* the same x-y

> Does that also happens if I
> dispatch a synthetic event using dispatchEvent()?

That should happen for a synthetic event. I am working on that at

> (Not having thought much about it this seems especially hairy for
> elements from the ordinary node tree that interleaved via a <content>
> element.)
> 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.

I don't have a clear idea about what should be cloned when crossing
boundaries. That's unclear for me.

> --
> http://annevankesteren.nl/


More information about the whatwg mailing list