aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMisko Hevery2010-02-04 14:02:20 -0800
committerMisko Hevery2010-02-04 14:02:20 -0800
commit9f919c42f0885e39870195fab8ce2a22621119b7 (patch)
treee125755fd371c9be686763c9e7b1f280363de754 /src
parent1da18e73a4d09b2a1ace92a4094eeba014eb7dc4 (diff)
downloadangular.js-9f919c42f0885e39870195fab8ce2a22621119b7.tar.bz2
better handling of $invalidWidgets
Diffstat (limited to 'src')
-rw-r--r--src/Angular.js1
-rw-r--r--src/Binder.js2
-rw-r--r--src/Scope.js5
3 files changed, 7 insertions, 1 deletions
diff --git a/src/Angular.js b/src/Angular.js
index ded4485f..fa6a610c 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -294,6 +294,7 @@ function wireAngular(element, config) {
'$anchor' : binder.anchor,
'$updateView': _(binder.updateView).bind(binder),
'$config' : config,
+ '$invalidWidgets': [],
'$console' : window.console,
'$datastore' : exposeMethods(datastore, {
'load': datastore.load,
diff --git a/src/Binder.js b/src/Binder.js
index e516ec32..8dac934b 100644
--- a/src/Binder.js
+++ b/src/Binder.js
@@ -95,7 +95,7 @@ Binder.prototype = {
updateView: function() {
var start = new Date().getTime();
var scope = jQuery(this.doc).scope();
- scope.set("$invalidWidgets", []);
+ scope.clearInvalid();
scope.updateView();
var end = new Date().getTime();
this.updateAnchor();
diff --git a/src/Scope.js b/src/Scope.js
index b8fadfa0..cedb0542 100644
--- a/src/Scope.js
+++ b/src/Scope.js
@@ -153,6 +153,11 @@ Scope.prototype = {
return expression({scope:this, datastore:datastore});
},
+ clearInvalid: function() {
+ var invalid = this.state['$invalidWidgets'];
+ while(invalid.length > 0) {invalid.pop();}
+ },
+
markInvalid: function(widget) {
this.state['$invalidWidgets'].push(widget);
},