diff options
Diffstat (limited to 'src/Angular.js')
| -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 bf64c6c2..45023d6c 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -215,6 +215,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 @@ -228,6 +243,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){ @@ -235,6 +251,8 @@ function extend(dst) {        });      }    }); + +  setHashKey(dst,h);    return dst;  } @@ -594,12 +612,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;  | 
