Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 8c1b4c0

Browse files
committed
refactor(*): remove ignored expensiveChecks argument passed to $parse()
This is a follow-up to #15094. Closes #15680
1 parent edfb691 commit 8c1b4c0

File tree

3 files changed

+7
-26
lines changed

3 files changed

+7
-26
lines changed

src/ng/directive/ngEventDirs.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ forEach(
5353
return {
5454
restrict: 'A',
5555
compile: function($element, attr) {
56-
// We expose the powerful $event object on the scope that provides access to the Window,
57-
// etc. that isn't protected by the fast paths in $parse. We explicitly request better
58-
// checks at the cost of speed since event handler expressions are not executed as
59-
// frequently as regular change detection.
60-
var fn = $parse(attr[directiveName], /* interceptorFn */ null, /* expensiveChecks */ true);
56+
// NOTE:
57+
// We expose the powerful `$event` object on the scope that provides access to the Window,
58+
// etc. This is OK, because expressions are not sandboxed any more (and the expression
59+
// sandbox was never meant to be a security feature anyway).
60+
var fn = $parse(attr[directiveName]);
6161
return function ngEventHandler(scope, element) {
6262
element.on(eventName, function(event) {
6363
var callback = function() {
64-
fn(scope, {$event:event});
64+
fn(scope, {$event: event});
6565
};
6666
if (forceAsyncEvents[eventName] && $rootScope.$$phase) {
6767
scope.$evalAsync(callback);

src/ngAria/aria.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
355355
return {
356356
restrict: 'A',
357357
compile: function(elem, attr) {
358-
var fn = $parse(attr.ngClick, /* interceptorFn */ null, /* expensiveChecks */ true);
358+
var fn = $parse(attr.ngClick);
359359
return function(scope, elem, attr) {
360360

361361
if (!isNodeOneOf(elem, nodeBlackList)) {

test/ng/parseSpec.js

-19
Original file line numberDiff line numberDiff line change
@@ -2635,25 +2635,6 @@ describe('parser', function() {
26352635
expect(log).toEqual('');
26362636
}));
26372637

2638-
it('should work with expensive checks', inject(function($parse, $rootScope, log) {
2639-
var fn = $parse('::foo', null, true);
2640-
$rootScope.$watch(fn, function(value, old) { if (value !== old) log(value); });
2641-
2642-
$rootScope.$digest();
2643-
expect($rootScope.$$watchers.length).toBe(1);
2644-
2645-
$rootScope.foo = 'bar';
2646-
$rootScope.$digest();
2647-
expect($rootScope.$$watchers.length).toBe(0);
2648-
expect(log).toEqual('bar');
2649-
log.reset();
2650-
2651-
$rootScope.foo = 'man';
2652-
$rootScope.$digest();
2653-
expect($rootScope.$$watchers.length).toBe(0);
2654-
expect(log).toEqual('');
2655-
}));
2656-
26572638
it('should have a stable value if at the end of a $digest it has a defined value', inject(function($parse, $rootScope, log) {
26582639
var fn = $parse('::foo');
26592640
$rootScope.$watch(fn, function(value, old) { if (value !== old) log(value); });

0 commit comments

Comments
 (0)