aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/directive
diff options
context:
space:
mode:
authorVojta Jina2012-03-28 16:03:59 -0700
committerIgor Minar2012-03-29 07:30:32 -0700
commit6da355c3e1571b9a104fca2796df77a4194a28a2 (patch)
tree8599843420c713b0a835e02311065fa984dcb1ee /src/ng/directive
parentf2106692b1ebf00aa5f8b2accd75f014b6cd4faa (diff)
downloadangular.js-6da355c3e1571b9a104fca2796df77a4194a28a2.tar.bz2
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.
Diffstat (limited to 'src/ng/directive')
-rw-r--r--src/ng/directive/booleanAttrDirs.js4
-rw-r--r--src/ng/directive/input.js2
2 files changed, 3 insertions, 3 deletions
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);
});
diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js
index 7343c358..2f7a6a64 100644
--- a/src/ng/directive/input.js
+++ b/src/ng/directive/input.js
@@ -1181,7 +1181,7 @@ var ngValueDirective = [function() {
attr.$set('value', scope.$eval(attr.ngValue));
};
} else {
- attr.$observers.value = [];
+ attr.$$observers.value = [];
return function(scope) {
scope.$watch(attr.ngValue, function(value) {