vendor/assets/javascripts/xooie/event_handler.js in xooie-1.0.7 vs vendor/assets/javascripts/xooie/event_handler.js in xooie-1.0.8

- old
+ new

@@ -46,11 +46,11 @@ formattedType = format(type, this.namespace); if (helpers.isUndefined(this.handlers[formattedType])) { this.handlers[formattedType] = function () { - [].splice.call(arguments, 1, 0, this); + [].splice.call(arguments, 0, 0, this); self.fire.apply(self, arguments); }; } if (helpers.isUndefined(this._callbacks[type])) { @@ -66,18 +66,20 @@ if (!helpers.isUndefined(this._callbacks[type])) { this._callbacks[type].empty(); } }; - EventHandler.prototype.fire = function (event) { + EventHandler.prototype.fire = function (context, event) { + var args; + if (event.namespace && event.namespace !== this.namespace) { return; } - var args = [].slice.call(arguments, 1); + args = [].slice.call(arguments, 1); if (!helpers.isUndefined(this._callbacks[event.type])) { - this._callbacks[event.type].fireWith.apply(this._callbacks[event.type].fireWith, args); + this._callbacks[event.type].fireWith(context, args); } }; return EventHandler; });