WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
102663
[Shadow DOM]: Event listeners are invoked for events with the same target and relatedTarget
https://bugs.webkit.org/show_bug.cgi?id=102663
Summary
[Shadow DOM]: Event listeners are invoked for events with the same target and...
Sergey G. Grekhov
Reported
2012-11-19 01:43:46 PST
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)
Attachments
Add attachment
proposed patch, testcase, etc.
Hayato Ito
Comment 1
2012-12-06 03:00:26 PST
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.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug