Skip to content

Commit 172daed

Browse files
committed
Merge pull request jashkenas#2930 from tgriesser/remove-reference-patch
Move delete back to model.remove
2 parents 405efc7 + d381ee9 commit 172daed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backbone.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,8 @@
649649
for (i = 0, l = models.length; i < l; i++) {
650650
model = models[i] = this.get(models[i]);
651651
if (!model) continue;
652+
delete this._byId[model.id];
653+
delete this._byId[model.cid];
652654
index = this.indexOf(model);
653655
this.models.splice(index, 1);
654656
this.length--;
@@ -924,8 +926,6 @@
924926

925927
// Internal method to sever a model's ties to a collection.
926928
_removeReference: function(model, options) {
927-
delete this._byId[model.id];
928-
delete this._byId[model.cid];
929929
if (this === model.collection) delete model.collection;
930930
model.off('all', this._onModelEvent, this);
931931
},

0 commit comments

Comments
 (0)