Skip to content

Commit

Permalink
Merge pull request jashkenas#3489 from jridgewell/trigger-for-slice
Browse files Browse the repository at this point in the history
Use for-loop, instead of slice
  • Loading branch information
jashkenas committed Feb 23, 2015
2 parents 685ec1f + 2c83984 commit caafa67
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,10 @@
// receive the true name of the event as the first argument).
Events.trigger = function(name) {
if (!this._events) return this;
var args = slice.call(arguments, 1);

var length = Math.max(0, arguments.length - 1);
var args = Array(length);
for (var i = 0; i < length; i++) args[i] = arguments[i + 1];

eventsApi(triggerApi, this, name, void 0, args);
return this;
Expand Down

0 comments on commit caafa67

Please sign in to comment.