[Pkg-javascript-commits] [dojo] 126/149: fixes #16257, cloning of sparse arrays

David Prévot taffit at moszumanska.debian.org
Sat Feb 27 03:13:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository dojo.

commit 4c39c14349408fc8274e19b399ffc660512ed07c
Author: Dylan Schiemann <dylan at dojotoolkit.org>
Date:   Mon Jan 4 03:18:36 2016 -0700

    fixes #16257, cloning of sparse arrays
---
 _base/lang.js            | 2 +-
 tests/unit/_base/lang.js | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/_base/lang.js b/_base/lang.js
index 579450b..c72ee0b 100644
--- a/_base/lang.js
+++ b/_base/lang.js
@@ -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
diff --git a/tests/unit/_base/lang.js b/tests/unit/_base/lang.js
index bc175ff..0e7a661 100644
--- a/tests/unit/_base/lang.js
+++ b/tests/unit/_base/lang.js
@@ -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 () {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git



More information about the Pkg-javascript-commits mailing list