Skip to content

Instantly share code, notes, and snippets.

@srolel
Created June 3, 2015 23:52
Show Gist options
  • Save srolel/9def16b61893809eee25 to your computer and use it in GitHub Desktop.
Save srolel/9def16b61893809eee25 to your computer and use it in GitHub Desktop.
angular depth-first scope traverse from `Scope.$digest`
let next, current = root, target = root
do {
console.log(current.$$watchers)
if (!(next = ((current.$$watchers.length && current.$$childHead) ||
(current !== target && current.$$nextSibling)))) {
while (current !== target && !(next = current.$$nextSibling)) {
current = current.$parent;
}
}
} while ((current = next));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment