diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Angular.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Angular.js b/src/Angular.js index 0d8de4ae..829743a3 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -195,6 +195,21 @@ function nextUid() { return uid.join(''); } + +/** + * Set or clear the hashkey for an object. + * @param obj object + * @param h the hashkey (!truthy to delete the hashkey) + */ +function setHashKey(obj, h) { + if (h) { + obj.$$hashKey = h; + } + else { + delete obj.$$hashKey; + } +} + /** * @ngdoc function * @name angular.extend @@ -208,6 +223,7 @@ function nextUid() { * @param {...Object} src Source object(s). */ function extend(dst) { + var h = dst.$$hashKey; forEach(arguments, function(obj){ if (obj !== dst) { forEach(obj, function(value, key){ @@ -215,6 +231,8 @@ function extend(dst) { }); } }); + + setHashKey(dst,h); return dst; } @@ -569,12 +587,14 @@ function copy(source, destination){ destination.push(copy(source[i])); } } else { + var h = destination.$$hashKey; forEach(destination, function(value, key){ delete destination[key]; }); for ( var key in source) { destination[key] = copy(source[key]); } + setHashKey(destination,h); } } return destination; |
