Browse files

To avoid side-effects, clone objects array on Data.Collection creation.

  • Loading branch information...
1 parent 91e90c3 commit 79aee27bfdbba550b56890e4d30efed1edc11866 Michael Aufreiter committed May 2, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 data.js
View
2 data.js
@@ -457,7 +457,7 @@
// Creates a Data.Collection using a Data.Type, and an array of Data.Objects
Data.Collection.create = function(type, objects) {
var c = new Data.Collection({type: type, objects: []});
- c.objects = objects;
+ c.objects = _.clone(objects);
c.length = objects.length;
// Register keys for fast lookup

0 comments on commit 79aee27

Please sign in to comment.