Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
var previousBackbone = root.Backbone;

// Create local references to array methods we'll want to use later.
var array = [];
var slice = array.slice;
var slice = Array.prototype.slice;

// Current version of the library. Keep in sync with `package.json`.
Backbone.VERSION = '1.1.2';
Expand Down Expand Up @@ -276,16 +275,11 @@
// passed the same arguments as `trigger` is, apart from the event name
// (unless you're listening on `"all"`, which will cause your callback to
// receive the true name of the event as the first argument).
Events.trigger = function(name) {
Events.trigger = _.restArgs(function(name, args) {
if (!this._events) return this;

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;
};
});

// Handles triggering the appropriate event callbacks.
var triggerApi = function(obj, name, cb, args) {
Expand Down Expand Up @@ -328,11 +322,10 @@
case 4: return function(iteratee, defaultVal, context) {
return _[method](this[attribute], iteratee, defaultVal, context);
};
default: return function() {
var args = slice.call(arguments);
default: return _.restArgs(function(args) {
args.unshift(this[attribute]);
return _[method].apply(_, args);
};
});
}
};
var addUnderscoreMethods = function(Class, methods, attribute) {
Expand Down