Steve's patch to make findController work in ShadowDOM context: it's no longer generalized, but at least it does what it's supposed to in polyfill, the generic notion of delegate-to-node-with-controller-property will need championing separately

This commit is contained in:
Scott Miles
2012-11-05 11:41:41 -08:00
parent e340cf7b7a
commit a88671ed23

View File

@@ -469,17 +469,18 @@ license that can be found in the LICENSE file.
// newer experimental event handler // newer experimental event handler
var findController = function(inNode) { var findController = function(inNode) {
// find the nearest *containing* controller // find the shadow root that contains inNode
var n = inNode.parentNode; var n = inNode.changeling || inNode;
while (n) { while (n.parentNode && n.tagName !== 'SHADOW-ROOT') {
if (n.controller) { n = n.parentNode;
return n.controller; if (n.changeling) {
n = n.changeling;
} }
n = n.parentNode || n.host;
} }
return n.host.controller;
}; };
_ = function(inHandlerName) { var _ = function(inHandlerName) {
var controller = findController(event.currentTarget); var controller = findController(event.currentTarget);
//console.log(inHandler, owner, event); //console.log(inHandler, owner, event);
if (controller && controller[inHandlerName]) { if (controller && controller[inHandlerName]) {