Skip to content

Commit

Permalink
Reverting jashkenas#2106 -- satisfying lint.
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Jan 16, 2013
1 parent f1b2785 commit 9b3fa12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions backbone.js
Expand Up @@ -556,7 +556,6 @@
options || (options = {});
if (options.model) this.model = options.model;
if (options.comparator !== void 0) this.comparator = options.comparator;
this.models = [];
this._reset();
this.initialize.apply(this, arguments);
if (models) this.reset(models, _.extend({silent: true}, options));
Expand Down Expand Up @@ -591,7 +590,7 @@
var i, l, model, attrs, existing, doSort, add, at, sort, sortAttr;
add = [];
at = options.at;
sort = this.comparator && (at == null) && options.sort != false;
sort = this.comparator && (at == null) && options.sort !== false;
sortAttr = _.isString(this.comparator) ? this.comparator : null;

// Turn bare objects into model references, and prevent invalid models
Expand Down Expand Up @@ -797,7 +796,7 @@
for (var i = 0, l = this.models.length; i < l; i++) {
this._removeReference(this.models[i]);
}
options.previousModels = this.models.slice();
options.previousModels = this.models;
this._reset();
if (models) this.add(models, _.extend({silent: true}, options));
if (!options.silent) this.trigger('reset', this, options);
Expand Down Expand Up @@ -850,7 +849,7 @@
// Reset all internal state. Called when the collection is reset.
_reset: function() {
this.length = 0;
this.models.length = 0;
this.models = [];
this._byId = {};
},

Expand Down
2 changes: 1 addition & 1 deletion test/collection.js
Expand Up @@ -511,7 +511,7 @@ $(document).ready(function() {

test("reset", 10, function() {
var resetCount = 0;
var models = col.models.slice();
var models = col.models;
col.on('reset', function() { resetCount += 1; });
col.reset([]);
equal(resetCount, 1);
Expand Down

0 comments on commit 9b3fa12

Please sign in to comment.