aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ng/rootScope.js22
-rw-r--r--test/ng/rootScopeSpec.js2
2 files changed, 12 insertions, 12 deletions
diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js
index bd712e07..759b4c72 100644
--- a/src/ng/rootScope.js
+++ b/src/ng/rootScope.js
@@ -195,7 +195,6 @@ function $RootScopeProvider(){
child['this'] = child;
child.$$listeners = {};
child.$parent = this;
- child.$$asyncQueue = [];
child.$$watchers = child.$$nextSibling = child.$$childHead = child.$$childTail = null;
child.$$prevSibling = this.$$childTail;
if (this.$$childHead) {
@@ -362,7 +361,7 @@ function $RootScopeProvider(){
$digest: function() {
var watch, value, last,
watchers,
- asyncQueue,
+ asyncQueue = this.$$asyncQueue,
length,
dirty, ttl = TTL,
next, current, target = this,
@@ -371,18 +370,19 @@ function $RootScopeProvider(){
beginPhase('$digest');
- do {
+ do { // "while dirty" loop
dirty = false;
current = target;
- do {
- asyncQueue = current.$$asyncQueue;
- while(asyncQueue.length) {
- try {
- current.$eval(asyncQueue.shift());
- } catch (e) {
- $exceptionHandler(e);
- }
+
+ while(asyncQueue.length) {
+ try {
+ current.$eval(asyncQueue.shift());
+ } catch (e) {
+ $exceptionHandler(e);
}
+ }
+
+ do { // "traverse the scopes" loop
if ((watchers = current.$$watchers)) {
// process our watches
length = watchers.length;
diff --git a/test/ng/rootScopeSpec.js b/test/ng/rootScopeSpec.js
index 2ceb0eec..9830d981 100644
--- a/test/ng/rootScopeSpec.js
+++ b/test/ng/rootScopeSpec.js
@@ -441,7 +441,7 @@ describe('Scope', function() {
child.$evalAsync(function(scope) { log += 'child.async;'; });
child.$watch('value', function() { log += 'child.$digest;'; });
$rootScope.$digest();
- expect(log).toEqual('parent.async;parent.$digest;child.async;child.$digest;');
+ expect(log).toEqual('parent.async;child.async;parent.$digest;child.$digest;');
}));
it('should cause a $digest rerun', inject(function($rootScope) {