Skip to content

Commit

Permalink
fixes #16257, cloning of sparse arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
dylans committed Jan 4, 2016
1 parent a19a1c7 commit 4c39c14
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _base/lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ define(["./kernel", "../has", "../sniff"], function(dojo, has){
r = [];
for(i = 0, l = src.length; i < l; ++i){
if(i in src){
r.push(lang.clone(src[i]));
r[i] = lang.clone(src[i]);
}
}
// we don't clone functions for performance reasons
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/_base/lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ define([
};

assert.deepEqual(obj1, lang.clone(obj1));
obj1.baz.b[6] = "c"; // intentional sparse populatation
assert.deepEqual(obj1.baz.b, lang.clone(obj1).baz.b, "Sparse arrays should be equal");
},

'.delegate': function () {
Expand Down

0 comments on commit 4c39c14

Please sign in to comment.