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:03 -0800
commit28273b7f1ef52e46d5bc23c41bc7a1492cf23014 (patch)
tree2d50947ab191829e4e05614255cd8be977e79fd6 /src/Angular.js
parentec54712ff3dab1ade44f94fa82d67edeffa79a1d (diff)
downloadangular.js-28273b7f1ef52e46d5bc23c41bc7a1492cf23014.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)) {