diff options
| author | Igor Minar | 2013-02-04 08:56:51 -0800 | 
|---|---|---|
| committer | Igor Minar | 2013-02-11 14:07:03 -0800 | 
| commit | 28273b7f1ef52e46d5bc23c41bc7a1492cf23014 (patch) | |
| tree | 2d50947ab191829e4e05614255cd8be977e79fd6 /src/Angular.js | |
| parent | ec54712ff3dab1ade44f94fa82d67edeffa79a1d (diff) | |
| download | angular.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.js | 3 | 
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)) { | 
