diff --git a/packages/ui/base.js b/packages/ui/base.js index c285d16e49..da515003a9 100644 --- a/packages/ui/base.js +++ b/packages/ui/base.js @@ -303,16 +303,18 @@ UI.Component.notifyParented = function () { var wrappedHandler = function (event) { var comp = UI.DomRange.getContainingComponent(event.currentTarget); var data = comp && getComponentData(comp); + var args = _.toArray(arguments); updateTemplateInstance(self); return Deps.nonreactive(function () { + // put self.templateInstance as the second argument + args.splice(1, 0, self.templateInstance); // Don't want to be in a deps context, even if we were somehow // triggered synchronously in an existing deps context // (the `blur` event can do this). // XXX we should probably do what Spark did and block all // event handling during our DOM manip. Many apps had weird // unanticipated bugs until we did that. - return esh.handler.call(data === null ? {} : data, - event, self.templateInstance); + return esh.handler.apply(data === null ? {} : data, args); }); }; diff --git a/packages/ui/domrange.js b/packages/ui/domrange.js index d4326a62a0..cc0460cd41 100644 --- a/packages/ui/domrange.js +++ b/packages/ui/domrange.js @@ -872,7 +872,7 @@ var HandlerRec = function (elem, type, selector, handler, $ui) { return; if (! h.$ui.contains(evt.currentTarget)) return; - return h.handler.call(h.$ui, evt); + return h.handler.apply(h.$ui, arguments); }; })(this);