[Webkit-unassigned] [Bug 102069] New: [Shadow DOM]: Event with both target and relatedTarget in the same tree is not stopped at Shadow boundary

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 13 04:42:50 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=102069

           Summary: [Shadow DOM]: Event with both target and relatedTarget
                    in the same tree is not stopped at Shadow boundary
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: HTML DOM
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: sgrekhov at unipro.ru


According the Shadow Dom specification "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.". But in fact such events are not stopped at the Shadow boundary. 

Run the following example:

<html>
<head>
<script type="text/javascript">
function test() {
    var d = document;
    var SR = window.ShadowRoot || window.WebKitShadowRoot;    

    //Shadow root to play with
    var s = new SR(d.querySelector('#host'));

    var div1 = d.createElement('div');
    div1.setAttribute('style', 'height:40px; width:100%');
    div1.setAttribute('id', 'div1');
    s.appendChild(div1);

    var div2 = d.createElement('div');
    div2.setAttribute('style', 'height:40px; width:100%');
    div2.setAttribute('id', 'div2');
    s.appendChild(div2);

    s.addEventListener('mouseover', function(event) {
        if (event.relatedTarget.getAttribute('id') != 'div1') {
            alert('Wrong relatedTarget');
        }
    }, false);

    d.body.addEventListener('mouseover', function(event) {
        alert('Event must be stopped at Shadow boundary!!!!');     
    }, false);

    var evt = document.createEvent("MouseEvents");
    evt.initMouseEvent("mouseover", true, false, window,
      0, 10, 10, 10, 10, false, false, false, false, 0, div1);

    div2.dispatchEvent(evt);
}
</script>
</head>
<body onload="test()">

<div id="host">
</div>

</body>
</html>

Event shouldn't buble up to document.body event listener but it bubles.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list