diff --git a/src/g-component.html b/src/g-component.html index 266b8382..7f653ef3 100644 --- a/src/g-component.html +++ b/src/g-component.html @@ -372,7 +372,7 @@ license that can be found in the LICENSE file. this[inMethod].apply(this, inArgs); }.bind(this), 0); }; - + // decorate HTMLElementElement with toolkit API HTMLElementElement.prototype.component = function(inUber) { @@ -469,17 +469,18 @@ license that can be found in the LICENSE file. // newer experimental event handler var findController = function(inNode) { - // find the nearest *containing* controller - var n = inNode.parentNode; - while (n) { - if (n.controller) { - return n.controller; + // find the shadow root that contains inNode + var n = inNode.changeling || inNode; + while (n.parentNode && n.tagName !== 'SHADOW-ROOT') { + n = n.parentNode; + 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); //console.log(inHandler, owner, event); if (controller && controller[inHandlerName]) {