From 6da355c3e1571b9a104fca2796df77a4194a28a2 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Wed, 28 Mar 2012 16:03:59 -0700 Subject: refactor($compile): move methods of attr object into prototype We have many instances of this object and we clone them as well (e.g. ng-repeat). This should save some memory and performance as well. Double prefixed private properties of attr object: attr.$element -> attr.$$element attr.$observers -> attr.$$observers Update shallowCopy to not copy $$ properties and allow passing optional destination object. --- src/ng/directive/booleanAttrDirs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ng/directive/booleanAttrDirs.js') diff --git a/src/ng/directive/booleanAttrDirs.js b/src/ng/directive/booleanAttrDirs.js index f79c02ce..f0182610 100644 --- a/src/ng/directive/booleanAttrDirs.js +++ b/src/ng/directive/booleanAttrDirs.js @@ -286,7 +286,7 @@ forEach(BOOLEAN_ATTR, function(propName, attrName) { priority: 100, compile: function(tpl, attr) { return function(scope, element, attr) { - attr.$observers[attrName] = []; + attr.$$observers[attrName] = []; scope.$watch(attr[normalized], function(value) { attr.$set(attrName, value); }); @@ -305,7 +305,7 @@ forEach(['src', 'href'], function(attrName) { priority: 100, compile: function(tpl, attr) { return function(scope, element, attr) { - attr.$observers[attrName] = []; + attr.$$observers[attrName] = []; attr.$observe(normalized, function(value) { attr.$set(attrName, value); }); -- cgit v1.2.3