[Bug 28444] [Shadow]: Make event retargeting optional

https://www.w3.org/Bugs/Public/show_bug.cgi?id=28444

--- Comment #5 from Daniel Freedman <dfreedm@google.com> ---
I think retargeting events for "open" shadowroots is still the right paradigm.

When composing elements with ShadowRoots together, it is far more useful to
think of those elements as one whole, rather than their constituent pieces.
With retargeting, a developer can use very simple event delegation in their own
scope with event.target for discrete composition points, rather than some more
complicated ancestry checking.

For example:

If I have a fancy tab bar that controls content

  <tab-bar>
    #shadow-root
      <t-ab id="one">
        #shadow-root
          <fancy-ripple-effect></fancy-ripple-effect>
          Tab One!
      </t-ab>
      <t-ab id="two">
        (..snip..)
        Tab Two!
      </t-ab>
  </tab-bar>

and click on the first tab, with retargeting I can just check event.target ===
#one to show the associated content.

With event retargeting, each composition boundary can have this simple event
delegation construct and be very intuitive for development.

I see event.path as more useful for a global event delegation mechanism, such
as for determining desired scrolling behavior with touch events:

  for (var i = 0, el; el = touchEvent.path[i]; i++)
    if (el._shouldStopScrolling)
      touchEvent.preventDefault();

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Monday, 13 April 2015 22:17:19 UTC