[Webkit-unassigned] [Bug 102663] New: [Shadow DOM]: Event listeners are invoked for events with the same target and relatedTarget
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Nov 19 01:41:50 PST 2012
https://bugs.webkit.org/show_bug.cgi?id=102663
Summary: [Shadow DOM]: Event listeners are invoked for events
with the same target and relatedTarget
Product: WebKit
Version: 528+ (Nightly build)
Platform: Unspecified
OS/Version: Unspecified
Status: UNCONFIRMED
Severity: Normal
Priority: P2
Component: Event Handling
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: sgrekhov at unipro.ru
According Shadow DOM specification (http://www.w3.org/TR/shadow-dom/#retargeting-related-target) "Event listeners must not be invoked on a DOM node for which the target and relatedTarget are the same.". But in fact it doesn't work. Please run the following example in Chrome (found in Chrome 23.0.1271.64 m):
<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:50%; width:100%');
div1.setAttribute('id', 'div1');
s.appendChild(div1);
div1.addEventListener('mouseover', function(event) {
console.log('div1:Event listeners shouldn\'t be invoked if target and relatedTarget are the same');
}, false);
d.body.addEventListener('mouseover', function(event) {
console.log('body:Event listeners shouldn\'t be invoked if target and relatedTarget are the same');
}, false);
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("mouseover", true, false, window,
0, 10, 10, 10, 10, false, false, false, false, 0, div1);
div1.dispatchEvent(evt);
}
</script>
</head>
<body onload="test()">
<div id="host">
</div>
</body>
</html>
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)
--
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