diff options
| author | Shyam Seshadri | 2010-06-02 15:05:34 -0700 | 
|---|---|---|
| committer | Shyam Seshadri | 2010-06-02 15:05:34 -0700 | 
| commit | 39312d1fe3a27b248f98f6f26577fcd7e2c64f85 (patch) | |
| tree | 244c0f72c1685da2db10f2bb2a2da49816829306 /src/Scope.js | |
| parent | a29c5e4c7fd5e708c28e70e974bf873621d5277c (diff) | |
| download | angular.js-39312d1fe3a27b248f98f6f26577fcd7e2c64f85.tar.bz2 | |
Revert "Revert "removed few key foreach and replaced thime with for loop for performance.""
This reverts commit a29c5e4c7fd5e708c28e70e974bf873621d5277c.
Diffstat (limited to 'src/Scope.js')
| -rw-r--r-- | src/Scope.js | 21 | 
1 files changed, 12 insertions, 9 deletions
| diff --git a/src/Scope.js b/src/Scope.js index 1c223130..637fc25e 100644 --- a/src/Scope.js +++ b/src/Scope.js @@ -53,14 +53,15 @@ function getterFn(path){    var code = 'function (self){\n';    code += '  var last, fn, type;\n';    foreach(path.split('.'), function(key) { +    key = (key == 'this')  ? '["this"]' : '.' + key;      code += '  if(!self) return self;\n';      code += '  last = self;\n'; -    code += '  self = self.' + key + ';\n'; +    code += '  self = self' + key + ';\n';      code += '  if(typeof self == "function") \n'; -    code += '    self = function(){ return last.'+key+'.apply(last, arguments); };\n'; -    if (key.charAt(0) == '$') { +    code += '    self = function(){ return last'+key+'.apply(last, arguments); };\n'; +    if (key.charAt(1) == '$') {        // special code for super-imposed functions -      var name = key.substr(1); +      var name = key.substr(2);        code += '  if(!self) {\n';        code += '    type = angular.Global.typeOf(last);\n';        code += '    fn = (angular[type.charAt(0).toUpperCase() + type.substring(1)]||{})["' + name + '"];\n'; @@ -123,11 +124,13 @@ function createScope(parent, services, existing) {        if (exp !== undefined) {          return expressionCompile(exp).apply(instance, slice.call(arguments, 1, arguments.length));        } else { -        foreach(evalLists.sorted, function(list) { -          foreach(list, function(eval) { -            instance.$tryEval(eval.fn, eval.handler); -          }); -        }); +        for ( var i = 0, iSize = evalLists.sorted.length; i < iSize; i++) { +          for ( var queue = evalLists.sorted[i], +                    jSize = queue.length, +                    j= 0; j < jSize; j++) { +            instance.$tryEval(queue[j].fn, queue[j].handler); +          } +        }        }      }, | 
