From d3ca1b2587a3778d55811c01aaded92040d36586 Mon Sep 17 00:00:00 2001 From: Georgios Kalpakas Date: Sun, 5 Feb 2017 15:11:13 +0200 Subject: [PATCH] refactor(*): remove ignored `expensiveChecks` argument to `$parse()` This is a follow-up to #15094. --- src/ng/directive/ngEventDirs.js | 12 ++++++------ src/ngAria/aria.js | 2 +- test/ng/parseSpec.js | 19 ------------------- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/src/ng/directive/ngEventDirs.js b/src/ng/directive/ngEventDirs.js index c7ac090c8720..8c21e0ac4748 100644 --- a/src/ng/directive/ngEventDirs.js +++ b/src/ng/directive/ngEventDirs.js @@ -53,15 +53,15 @@ forEach( return { restrict: 'A', compile: function($element, attr) { - // We expose the powerful $event object on the scope that provides access to the Window, - // etc. that isn't protected by the fast paths in $parse. We explicitly request better - // checks at the cost of speed since event handler expressions are not executed as - // frequently as regular change detection. - var fn = $parse(attr[directiveName], /* interceptorFn */ null, /* expensiveChecks */ true); + // NOTE: + // We expose the powerful `$event` object on the scope that provides access to the Window, + // etc. This is OK, because expressions are not sandboxed any more (and the expression + // sandbox was never meant to be a security feature anyway). + var fn = $parse(attr[directiveName]); return function ngEventHandler(scope, element) { element.on(eventName, function(event) { var callback = function() { - fn(scope, {$event:event}); + fn(scope, {$event: event}); }; if (forceAsyncEvents[eventName] && $rootScope.$$phase) { scope.$evalAsync(callback); diff --git a/src/ngAria/aria.js b/src/ngAria/aria.js index 6b97daa3d1c8..d46822d57a25 100644 --- a/src/ngAria/aria.js +++ b/src/ngAria/aria.js @@ -355,7 +355,7 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) { return { restrict: 'A', compile: function(elem, attr) { - var fn = $parse(attr.ngClick, /* interceptorFn */ null, /* expensiveChecks */ true); + var fn = $parse(attr.ngClick); return function(scope, elem, attr) { if (!isNodeOneOf(elem, nodeBlackList)) { diff --git a/test/ng/parseSpec.js b/test/ng/parseSpec.js index c815bb514261..1b6e428bfd4d 100644 --- a/test/ng/parseSpec.js +++ b/test/ng/parseSpec.js @@ -2635,25 +2635,6 @@ describe('parser', function() { expect(log).toEqual(''); })); - it('should work with expensive checks', inject(function($parse, $rootScope, log) { - var fn = $parse('::foo', null, true); - $rootScope.$watch(fn, function(value, old) { if (value !== old) log(value); }); - - $rootScope.$digest(); - expect($rootScope.$$watchers.length).toBe(1); - - $rootScope.foo = 'bar'; - $rootScope.$digest(); - expect($rootScope.$$watchers.length).toBe(0); - expect(log).toEqual('bar'); - log.reset(); - - $rootScope.foo = 'man'; - $rootScope.$digest(); - expect($rootScope.$$watchers.length).toBe(0); - expect(log).toEqual(''); - })); - it('should have a stable value if at the end of a $digest it has a defined value', inject(function($parse, $rootScope, log) { var fn = $parse('::foo'); $rootScope.$watch(fn, function(value, old) { if (value !== old) log(value); });