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

Commit 8863b9d

Browse files
committedAug 20, 2014
perf($parse): don't bind filters to a context
This change gives us ~10% boost in Chrome, less or nothing in other browsers. BREAKING CHANGE: `this` in filters is now undefined and no longer the scope It's a bad practice for filters to have hidden dependencies, so pulling stuff from scope directly is not a good idea. Scope being the filter context was never documented as public api, so we don't expect that any significant code depends on this behavior. If an existing filter has a dependency on the scope instance, the scope reference can be passed into the filter as a filter argument (this is highly discouraged for new code): Before: `{{ user.name | customFilter }}` After: `{{ user.name | customFilter:this }}`
1 parent d18b281 commit 8863b9d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/ng/parse.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -570,10 +570,10 @@ Parser.prototype = {
570570
args[i + 1] = argsFn[i](self, locals);
571571
}
572572

573-
return fn.apply(self, args);
573+
return fn.apply(undefined, args);
574574
}
575575

576-
return fn.call(self, input);
576+
return fn(input);
577577
});
578578
},
579579

0 commit comments

Comments
 (0)