<?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>102663</bug_id>
          
          <creation_ts>2012-11-19 01:43:46 -0800</creation_ts>
          <short_desc>[Shadow DOM]: Event listeners are invoked for events with the same target and relatedTarget</short_desc>
          <delta_ts>2012-12-06 03:00:26 -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>UI Events</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</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>
          <dependson>102681</dependson>
          <blocked>103230</blocked>
          <everconfirmed>0</everconfirmed>
          <reporter name="Sergey G. Grekhov">sgrekhov</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <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>770486</commentid>
    <comment_count>0</comment_count>
    <who name="Sergey G. Grekhov">sgrekhov</who>
    <bug_when>2012-11-19 01:43:46 -0800</bug_when>
    <thetext>According Shadow DOM specification (http://www.w3.org/TR/shadow-dom/#retargeting-related-target) &quot;Event listeners must not be invoked on a DOM node for which the target and relatedTarget are the same.&quot;. But in fact it doesn&apos;t work. Please run the following example in Chrome (found in Chrome 23.0.1271.64 m):

&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 s = new SR(d.querySelector(&apos;#host&apos;));

    var div1 = d.createElement(&apos;div&apos;);
    div1.setAttribute(&apos;style&apos;, &apos;height:50%; width:100%&apos;);
    div1.setAttribute(&apos;id&apos;, &apos;div1&apos;);
    s.appendChild(div1);

    div1.addEventListener(&apos;mouseover&apos;, function(event) {
        console.log(&apos;div1:Event listeners shouldn\&apos;t be invoked if target and relatedTarget are the same&apos;);
    }, false);

    
    d.body.addEventListener(&apos;mouseover&apos;, function(event) {
        console.log(&apos;body:Event listeners shouldn\&apos;t be invoked if target and relatedTarget are the same&apos;);
    }, false);
    
    var evt = document.createEvent(&quot;MouseEvents&quot;);
    evt.initMouseEvent(&quot;mouseover&quot;, true, false, window,
      0, 10, 10, 10, 10, false, false, false, false, 0, div1);

    div1.dispatchEvent(evt);
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body onload=&quot;test()&quot;&gt;

&lt;div id=&quot;host&quot;&gt;
&lt;/div&gt;

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



Observe JavaScript console. As you can see bot event listeners for div1 and body are invoked thorough event target and related target (see the last argument of initMouseEvent()) are the same (div1 for both)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>784805</commentid>
    <comment_count>1</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2012-12-06 03:00:26 -0800</bug_when>
    <thetext>Bug is filed for the Shadow DOM spec.
https://www.w3.org/Bugs/Public/show_bug.cgi?id=20017

The current behavior is okay. Let me close this.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>