<?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>102069</bug_id>
          
          <creation_ts>2012-11-13 04:44:35 -0800</creation_ts>
          <short_desc>[Shadow DOM]: Event with both target and relatedTarget in the same tree is not stopped at Shadow boundary</short_desc>
          <delta_ts>2012-12-06 02:57:36 -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>FIXED</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>765469</commentid>
    <comment_count>0</comment_count>
    <who name="Sergey G. Grekhov">sgrekhov</who>
    <bug_when>2012-11-13 04:44:35 -0800</bug_when>
    <thetext>According the Shadow Dom specification &quot;In cases where both relatedTarget and target are part of the same shadow tree, the conforming UAs must stop events at the shadow boundary to avoid the appearance of spurious mouseover and mouseout events firing from the same node.&quot;. But in fact such events are not stopped at the Shadow boundary. 

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 s = new SR(d.querySelector(&apos;#host&apos;));
    
    var div1 = d.createElement(&apos;div&apos;);
    div1.setAttribute(&apos;style&apos;, &apos;height:40px; width:100%&apos;);
    div1.setAttribute(&apos;id&apos;, &apos;div1&apos;);
    s.appendChild(div1);
    
    var div2 = d.createElement(&apos;div&apos;);
    div2.setAttribute(&apos;style&apos;, &apos;height:40px; width:100%&apos;);
    div2.setAttribute(&apos;id&apos;, &apos;div2&apos;);
    s.appendChild(div2);
    
    s.addEventListener(&apos;mouseover&apos;, function(event) {
    	if (event.relatedTarget.getAttribute(&apos;id&apos;) != &apos;div1&apos;) {
    		alert(&apos;Wrong relatedTarget&apos;);
    	}
    }, false);
    
    d.body.addEventListener(&apos;mouseover&apos;, function(event) {
        alert(&apos;Event must be stopped at Shadow boundary!!!!&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);
    
    div2.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;

Event shouldn&apos;t buble up to document.body event listener but it bubles.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>767927</commentid>
    <comment_count>1</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2012-11-15 04:01:20 -0800</bug_when>
    <thetext>Thank you for the reporting. Let me take a look tomorrow.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>784801</commentid>
    <comment_count>2</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2012-12-06 02:57:36 -0800</bug_when>
    <thetext>http://trac.webkit.org/changeset/136818 fixed this. Closing.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>