aboutsummaryrefslogtreecommitdiffstats
path: root/src/Scope.js
diff options
context:
space:
mode:
authorMisko Hevery2010-04-16 14:01:29 -0700
committerMisko Hevery2010-04-16 14:01:29 -0700
commitdeb86fe357a901889bc4289087f0b9e69cb8a302 (patch)
treefce4db8501a6c24430d611c95a4aa001119c7b89 /src/Scope.js
parent70e401ef100614295fc808e32f0142f07c315461 (diff)
downloadangular.js-deb86fe357a901889bc4289087f0b9e69cb8a302.tar.bz2
lots of small fixes
Diffstat (limited to 'src/Scope.js')
-rw-r--r--src/Scope.js12
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