diff options
| author | Misko Hevery | 2010-04-16 14:01:29 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2010-04-16 14:01:29 -0700 | 
| commit | deb86fe357a901889bc4289087f0b9e69cb8a302 (patch) | |
| tree | fce4db8501a6c24430d611c95a4aa001119c7b89 /src/Scope.js | |
| parent | 70e401ef100614295fc808e32f0142f07c315461 (diff) | |
| download | angular.js-deb86fe357a901889bc4289087f0b9e69cb8a302.tar.bz2 | |
lots of small fixes
Diffstat (limited to 'src/Scope.js')
| -rw-r--r-- | src/Scope.js | 12 | 
1 files changed, 9 insertions, 3 deletions
| diff --git a/src/Scope.js b/src/Scope.js index 8d44f4ef..54e75dbd 100644 --- a/src/Scope.js +++ b/src/Scope.js @@ -81,7 +81,7 @@ function createScope(parent, services, existing) {    function API(){}    function Behavior(){} -  var instance, behavior, api, evalLists = {}, servicesCache = extend({}, existing); +  var instance, behavior, api, evalLists = {sorted:[]}, servicesCache = extend({}, existing);    parent = Parent.prototype = (parent || {});    api = API.prototype = new Parent(); @@ -100,7 +100,7 @@ function createScope(parent, services, existing) {        if (isDefined(exp)) {          return expressionCompile(exp).apply(instance, slice.call(arguments, 1, arguments.length));        } else { -        foreachSorted(evalLists, function(list) { +        foreach(evalLists.sorted, function(list) {            foreach(list, function(eval) {              instance.$tryEval(eval.fn, eval.handler);            }); @@ -143,7 +143,13 @@ function createScope(parent, services, existing) {          expr = priority;          priority = 0;        } -      var evalList = evalLists[priority] || (evalLists[priority] = []); +      var evalList = evalLists[priority]; +      if (!evalList) { +        evalList = evalLists[priority] = []; +        evalList.priority = priority; +        evalLists.sorted.push(evalList); +        evalLists.sorted.sort(function(a,b){return a.priority-b.priority;}); +      }        evalList.push({          fn: expressionCompile(expr),          handler: exceptionHandler | 
