Skip to content

Commit

Permalink
refactor($compile): check removeWatches before calling
Browse files Browse the repository at this point in the history
Previously we assigned `noop` if there was no function but there is no
performance advantage in doing this since the check would have to happen
either at assignment time or at call time.

Removing this use of `noop` makes the code clearer, IMO :-)

Closes angular#12528
  • Loading branch information
petebacondarwin committed Oct 7, 2015
1 parent b51dd30 commit 4ad0ca1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ng/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2073,7 +2073,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
controllerForBindings = controller;
removeControllerBindingWatches =
initializeDirectiveBindings(scope, attrs, controller.instance,
bindings, scopeDirective) || noop;
bindings, scopeDirective);
}
}
for (i in elementControllers) {
Expand All @@ -2087,7 +2087,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
$element.data('$' + i + 'Controller', controllerResult);
if (controller === controllerForBindings) {
// Remove and re-install bindToController bindings
removeControllerBindingWatches();
removeControllerBindingWatches && removeControllerBindingWatches();
removeControllerBindingWatches =
initializeDirectiveBindings(scope, attrs, controllerResult, bindings, scopeDirective);
}
Expand Down

0 comments on commit 4ad0ca1

Please sign in to comment.