Skip to content

Commit

Permalink
To avoid side-effects, clone objects array on Data.Collection creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael committed May 2, 2012
1 parent 91e90c3 commit 79aee27
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion data.js
Expand Up @@ -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
Expand Down

0 comments on commit 79aee27

Please sign in to comment.