Skip to content
Permalink
Browse files

Model.List must test if Model exist when destroying

Test if target exist before splicing it from a Model.List. Otherwise the latest element will be removed.
  • Loading branch information...
roissard committed Aug 3, 2012
1 parent 517acce commit 44bc72063e429bbc3f8a9a696a3ae4a7e57d12c8
Showing with 3 additions and 1 deletion.
  1. +3 −1 model/model.js
@@ -1171,7 +1171,9 @@ steal('can/util','can/observe', function( can ) {
var self = this;
this.bind('change', function(ev, how){
if(/\w+\.destroyed/.test(how)){
self.splice(self.indexOf(ev.target),1);
if (self.indexOf(ev.target)!=-1) {}
self.splice(self.indexOf(ev.target),1);
}
}
})
}

0 comments on commit 44bc720

Please sign in to comment.
You can’t perform that action at this time.