<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>28444</bug_id>
          
          <creation_ts>2015-04-08 16:00:41 +0000</creation_ts>
          <short_desc>[Shadow]: Make event retargeting optional</short_desc>
          <delta_ts>2015-05-27 02:51:37 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - Component Model</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>MOVED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>15480</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Dimitri Glazkov">dglazkov</reporter>
          <assigned_to name="Hayato Ito">hayato</assigned_to>
          <cc>annevk</cc>
    
    <cc>dfreedm</cc>
    
    <cc>hayato</cc>
    
    <cc>mike</cc>
    
    <cc>public-webapps</cc>
    
    <cc>timdream</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>119375</commentid>
    <comment_count>0</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2015-04-08 16:00:41 +0000</bug_when>
    <thetext>From https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0052.html

Annevk: &quot;I think opt-in (or only
with isolated) would be better and perhaps if the API needs to change
anyway we can do that, but we could probably live with opt-out as
well. When you use shadow DOM to compose, global reasoning about state
and events is a fairly established pattern that we should enable.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119386</commentid>
    <comment_count>1</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2015-04-08 18:27:59 +0000</bug_when>
    <thetext>As far as I understand, the event.path is the mechanism to enable global reasoning about events. Optional event retargeting seems to be only complicating already complex algos. Consider a scenario where you have a mix of trees with and without retargeting.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119459</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-04-13 09:32:36 +0000</bug_when>
    <thetext>Yeah, which is why perhaps we should only do retargeting if the tree is explicitly closed. (Isolated would also have to do it of course.)

That seems like a much more logical model and allows for event.path and event.target to be consistent. The current approach seems a lot like the originalTarget approach from XBL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119478</commentid>
    <comment_count>3</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2015-04-13 17:42:47 +0000</bug_when>
    <thetext>(In reply to Anne from comment #2)
&gt; Yeah, which is why perhaps we should only do retargeting if the tree is
&gt; explicitly closed. (Isolated would also have to do it of course.)

This suggestion is interesting, but it is orthogonal to the complexity concern. I would still need extra branch points in the retargeting algos in order to account for nested trees that interleave the setting with and without retargeting (whether or not coupled to the closed/open setting), plus the extra transitive complexity of managing insertion points.

 
&gt; That seems like a much more logical model and allows for event.path and
&gt; event.target to be consistent. The current approach seems a lot like the
&gt; originalTarget approach from XBL.

Can you explain a bit more why event.path seems bad? As far as I can tell, it works well for consumers with event delegation needs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119479</commentid>
    <comment_count>4</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2015-04-13 18:01:23 +0000</bug_when>
    <thetext>+dfreedm to comment on the coupling of closed/open and retargeting opt-in idea.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119482</commentid>
    <comment_count>5</comment_count>
    <who name="Daniel Freedman">dfreedm</who>
    <bug_when>2015-04-13 22:17:16 +0000</bug_when>
    <thetext>I think retargeting events for &quot;open&quot; 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

  &lt;tab-bar&gt;
    #shadow-root
      &lt;t-ab id=&quot;one&quot;&gt;
        #shadow-root
          &lt;fancy-ripple-effect&gt;&lt;/fancy-ripple-effect&gt;
          Tab One!
      &lt;/t-ab&gt;
      &lt;t-ab id=&quot;two&quot;&gt;
        (..snip..)
        Tab Two!
      &lt;/t-ab&gt;
  &lt;/tab-bar&gt;

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();</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119910</commentid>
    <comment_count>6</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2015-04-27 03:17:25 +0000</bug_when>
    <thetext>Let me move this bug to v2 since it is not a blocker for v1.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>120500</commentid>
    <comment_count>7</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2015-05-27 02:51:37 +0000</bug_when>
    <thetext>Moved to https://github.com/w3c/webcomponents/issues/89</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>