mirror of
https://github.com/jashkenas/backbone.git
synced 2026-01-22 13:28:22 -05:00
Merge pull request #980 from vovik/new-master
fixes #972 by cleaning up a messy conditional
This commit is contained in:
@@ -511,8 +511,10 @@
|
||||
if (!(model = models[i] = this._prepareModel(models[i], options))) {
|
||||
throw new Error("Can't add an invalid model to a collection");
|
||||
}
|
||||
if (cids[cid = model.cid] || this._byCid[cid] ||
|
||||
(((id = model.id) != null) && (ids[id] || this._byId[id]))) {
|
||||
|
||||
cid = model.cid;
|
||||
id = model.id;
|
||||
if (cids[cid] || this._byCid[cid] || (id != null && (ids[id] || this._byId[id]))) {
|
||||
throw new Error("Can't add the same model to a collection twice");
|
||||
}
|
||||
cids[cid] = ids[id] = model;
|
||||
|
||||
Reference in New Issue
Block a user