mirror of
https://github.com/jashkenas/backbone.git
synced 2026-02-11 07:14:56 -05:00
Fixing Issue #109 -- ignore 'add' and 'remove' events that originate from models shared with other collections.
This commit is contained in:
@@ -564,8 +564,10 @@
|
||||
|
||||
// Internal method called every time a model in the set fires an event.
|
||||
// Sets need to update their indexes when models change ids. All other
|
||||
// events simply proxy through.
|
||||
_onModelEvent : function(ev, model) {
|
||||
// events simply proxy through. "add" and "remove" events that originate
|
||||
// in other collections are ignored.
|
||||
_onModelEvent : function(ev, model, collection) {
|
||||
if ((ev == 'add' || ev == 'remove') && collection != this) return;
|
||||
if (ev === 'change:id') {
|
||||
delete this._byId[model.previous('id')];
|
||||
this._byId[model.id] = model;
|
||||
|
||||
Reference in New Issue
Block a user