Bug 102767
Summary: | [Shadow DOM]: retargeting doesn't work for document nodes distributed among insertion points | ||
---|---|---|---|
Product: | WebKit | Reporter: | Sergey G. Grekhov <sgrekhov> |
Component: | DOM | Assignee: | Web Components Team <webcomponents-bugzilla> |
Status: | RESOLVED INVALID | ||
Severity: | Normal | CC: | dominicc, hayato, morrita, shinyak, webcomponents-bugzilla |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Bug Depends on: | |||
Bug Blocks: | 103230 |
Sergey G. Grekhov
Found in Chrome 23.0.1271.64 m
If node in Shadow tree is a document node distributed into insertion point then event retargeting doesn't work. 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 ul = d.querySelector('ul.stories');
var s = new SR(ul);
//make shadow subtree
var div = document.createElement('div');
div.innerHTML = '<ul id="ip_wrapper"><content select=".shadow"></content></ul>';
s.appendChild(div);
d.body.addEventListener('click', function (event) {
alert(event.target.tagName);
}, false);
var event = d.createEvent('HTMLEvents');
event.initEvent ("click", true, false);
d.querySelector('#li3').dispatchEvent(event);
}
</script>
</head>
<body onload="test()">
<ul class='stories'>
<li id='li1'><a href='#1'>Link1</a></li>
<li id='li2' title="li2"><a href='#2'>Link 2</a></li>
<li id='li3' class='shadow'><a href='#3'>Link 3 Shadow</a></li>
<li id='li4' class='shadow2'><a href='#4'>Link 4 Shadow 2</a></li>
<li id='li5'><a href='#5'>Link 5</a></li>
<li id='li6' class='shadow'><a href='#5'>Link 6 Shadow</a></li>
</ul>
</body>
</html>
This example shows that after bubbling up to the document body event target was not retargeted and shows tagName LI, but according to http://dvcs.w3.org/hg/webcomponents/raw-file/c2f82425ba8d/spec/shadow/index.html#event-retargeting target should be adjusted and shadow root (UL) should be the target
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Hayato Ito
This is an intended behavior for a event fired on a node which is distributed into a insertion point.
I think the spec is written to do so. Please re-open if you think the spec is wrong.