aboutsummaryrefslogtreecommitdiffstats
path: root/src/Angular.js
diff options
context:
space:
mode:
authorIgor Minar2013-02-04 08:56:51 -0800
committerIgor Minar2013-02-11 14:07:10 -0800
commita5b3bcf41cb0e3130439666a78a0ba9feadbd84a (patch)
tree1cb2cf70f76ddc29c657adb75479113051e0d77c /src/Angular.js
parent8801d9c2865ae74db4f4ce755764a9f46c49c9f8 (diff)
downloadangular.js-a5b3bcf41cb0e3130439666a78a0ba9feadbd84a.tar.bz2
refactor(angular.copy): use slice(0) to clone arrays
slice(0) is way faster on most browsers
Diffstat (limited to 'src/Angular.js')
-rw-r--r--src/Angular.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Angular.js b/src/Angular.js
index 4685dbde..d983fd19 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -556,7 +556,8 @@ function copy(source, destination){
destination = source;
if (source) {
if (isArray(source)) {
- destination = copy(source, []);
+ // http://jsperf.com/copy-array-with-slice-vs-for
+ destination = source.slice(0);
} else if (isDate(source)) {
destination = new Date(source.getTime());
} else if (isObject(source)) {