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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>102767</bug_id>
          
          <creation_ts>2012-11-19 22:03:45 -0800</creation_ts>
          <short_desc>[Shadow DOM]: retargeting doesn&apos;t work for document nodes distributed among insertion points</short_desc>
          <delta_ts>2013-01-10 02:38:22 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</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>103230</blocked>
          <everconfirmed>0</everconfirmed>
          <reporter name="Sergey G. Grekhov">sgrekhov</reporter>
          <assigned_to name="Web Components Team">webcomponents-bugzilla</assigned_to>
          <cc>dominicc</cc>
    
    <cc>hayato</cc>
    
    <cc>morrita</cc>
    
    <cc>shinyak</cc>
    
    <cc>webcomponents-bugzilla</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>771506</commentid>
    <comment_count>0</comment_count>
    <who name="Sergey G. Grekhov">sgrekhov</who>
    <bug_when>2012-11-19 22:03:45 -0800</bug_when>
    <thetext>Found in Chrome 23.0.1271.64 m
If node in Shadow tree is a document node distributed into insertion point then event retargeting doesn&apos;t work. Run the following example:

&lt;html&gt;
&lt;head&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function test() {
    var d = document;
    var SR = window.ShadowRoot || window.WebKitShadowRoot;

    //Shadow root to play with
    var ul = d.querySelector(&apos;ul.stories&apos;);
    var s = new SR(ul);
  
    //make shadow subtree
    var div = document.createElement(&apos;div&apos;);
    div.innerHTML = &apos;&lt;ul id=&quot;ip_wrapper&quot;&gt;&lt;content select=&quot;.shadow&quot;&gt;&lt;/content&gt;&lt;/ul&gt;&apos;;
    s.appendChild(div);
      
    d.body.addEventListener(&apos;click&apos;, function (event) {
        alert(event.target.tagName);
    }, false);
    
    var event = d.createEvent(&apos;HTMLEvents&apos;);
    event.initEvent (&quot;click&quot;, true, false);
    d.querySelector(&apos;#li3&apos;).dispatchEvent(event);         
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body onload=&quot;test()&quot;&gt;

    &lt;ul class=&apos;stories&apos;&gt;
        &lt;li id=&apos;li1&apos;&gt;&lt;a href=&apos;#1&apos;&gt;Link1&lt;/a&gt;&lt;/li&gt;
        &lt;li id=&apos;li2&apos; title=&quot;li2&quot;&gt;&lt;a href=&apos;#2&apos;&gt;Link 2&lt;/a&gt;&lt;/li&gt;
        &lt;li id=&apos;li3&apos; class=&apos;shadow&apos;&gt;&lt;a href=&apos;#3&apos;&gt;Link 3 Shadow&lt;/a&gt;&lt;/li&gt;
        &lt;li id=&apos;li4&apos; class=&apos;shadow2&apos;&gt;&lt;a href=&apos;#4&apos;&gt;Link 4 Shadow 2&lt;/a&gt;&lt;/li&gt;
        &lt;li id=&apos;li5&apos;&gt;&lt;a href=&apos;#5&apos;&gt;Link 5&lt;/a&gt;&lt;/li&gt;
        &lt;li id=&apos;li6&apos; class=&apos;shadow&apos;&gt;&lt;a href=&apos;#5&apos;&gt;Link 6 Shadow&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;

&lt;/body&gt;
&lt;/html&gt;


This example shows that after bubbling up to the document body event target was not retargeted and shows tagName LI, but according to http://dvcs.w3.org/hg/webcomponents/raw-file/c2f82425ba8d/spec/shadow/index.html#event-retargeting target should be adjusted and shadow root (UL) should be the target</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>804201</commentid>
    <comment_count>1</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2013-01-10 02:38:22 -0800</bug_when>
    <thetext>This is an intended behavior for a event fired on a node which is distributed into a insertion point.
I think the spec is written to do so. Please re-open if you think the spec is wrong.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>