diff options
| author | Misko Hevery | 2010-07-26 15:32:08 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-07-26 15:32:08 -0700 |
| commit | b288cb08b450cd28423595de82693631cc6d6dda (patch) | |
| tree | f3596cddffcb917f91c7cb4e7cbfa353f9831d9d /src/Scope.js | |
| parent | b2b170099f957e6575e309c35fed42915e95dd47 (diff) | |
| download | angular.js-b288cb08b450cd28423595de82693631cc6d6dda.tar.bz2 | |
minor performance improvements
Diffstat (limited to 'src/Scope.js')
| -rw-r--r-- | src/Scope.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Scope.js b/src/Scope.js index 549cc944..6b011936 100644 --- a/src/Scope.js +++ b/src/Scope.js @@ -131,7 +131,7 @@ function createScope(parent, services, existing) { $eval: function $eval(exp) { if (exp !== undefined) { - return expressionCompile(exp).apply(instance, slice.call(arguments, 1, arguments.length)); + return expressionCompile(exp).call(instance); } else { for ( var i = 0, iSize = evalLists.sorted.length; i < iSize; i++) { for ( var queue = evalLists.sorted[i], @@ -145,7 +145,7 @@ function createScope(parent, services, existing) { $tryEval: function (expression, exceptionHandler) { try { - return expressionCompile(expression).apply(instance, slice.call(arguments, 2, arguments.length)); + return expressionCompile(expression).call(instance); } catch (e) { (instance.$log || {error:error}).error(e); if (isFunction(exceptionHandler)) { @@ -161,12 +161,15 @@ function createScope(parent, services, existing) { $watch: function(watchExp, listener, exceptionHandler) { var watch = expressionCompile(watchExp), last; + listener = expressionCompile(listener); function watcher(){ var value = watch.call(instance), lastValue = last; if (last !== value) { last = value; - instance.$tryEval(listener, exceptionHandler, value, lastValue); + instance.$tryEval(function(){ + return listener.call(instance, value, lastValue); + }, exceptionHandler); } } instance.$onEval(PRIORITY_WATCH, watcher); |
