From 5a36b30d86b4c125eeb399b4ad67113e2e024efb Mon Sep 17 00:00:00 2001 From: "bret.ikehara" Date: Fri, 11 Sep 2015 09:58:06 -0700 Subject: [PATCH 1/2] fix(tooltip): Prefer to evaluate async Prefer to evaluate async over calling the apply method. Issue: #3557 --- src/tooltip/tooltip.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/tooltip/tooltip.js b/src/tooltip/tooltip.js index c88dc0eb4d..b92d41ec1e 100644 --- a/src/tooltip/tooltip.js +++ b/src/tooltip/tooltip.js @@ -210,10 +210,9 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s } function hideTooltipBind () { - hide(); - if (!$rootScope.$$phase) { - $rootScope.$digest(); - } + scope.$evalAsync(function () { + hide(); + }); } // Show the tooltip popup element. @@ -243,9 +242,7 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s isOpenExp.assign(ttScope.origScope, ttScope.isOpen); } - if (!$rootScope.$$phase) { - ttScope.$apply(); // digest required as $apply is not called - } + ttScope.$applyAsync(); // digest required as $apply is not called positionTooltip(); } From 44a846494c78788ee63f574f4afb1a6158a2abcb Mon Sep 17 00:00:00 2001 From: "bret.ikehara" Date: Fri, 11 Sep 2015 10:10:13 -0700 Subject: [PATCH 2/2] fix(tooltip): Do not recreate tooltip Do not recreate tooltip as this will add unnecessary processing to revive tooltip from the grave. Issue: #3557 --- src/tooltip/tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tooltip/tooltip.js b/src/tooltip/tooltip.js index b92d41ec1e..5f440b2a61 100644 --- a/src/tooltip/tooltip.js +++ b/src/tooltip/tooltip.js @@ -281,7 +281,7 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s function createTooltip() { // There can only be one tooltip element per directive shown at once. if (tooltip) { - removeTooltip(); + return; } tooltipLinkedScope = ttScope.$new(); tooltip = tooltipLinker(tooltipLinkedScope, function(tooltip) {