From 8fee75d517d38f3953d5d60e61c4987780083df2 Mon Sep 17 00:00:00 2001 From: Damien Abos Date: Mon, 7 Sep 2015 15:32:34 +0200 Subject: [PATCH] fix(tooltip): correct flash of reposition - Avoid position computation when tooltip is empty - Force visibility to none when resetting style Closes #4363 Fixes #4195 --- src/tooltip/tooltip.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tooltip/tooltip.js b/src/tooltip/tooltip.js index 864d861afc..b6666fd320 100644 --- a/src/tooltip/tooltip.js +++ b/src/tooltip/tooltip.js @@ -110,6 +110,7 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position']) 'animation="animation" '+ 'is-open="isOpen"'+ 'origin-scope="origScope" '+ + 'style="visibility: hidden"'+ '>'+ ''; @@ -132,12 +133,13 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position']) var isOpenExp = angular.isDefined(attrs[prefix + 'IsOpen']) ? $parse(attrs[prefix + 'IsOpen']) : false; var positionTooltip = function() { - if (!tooltip) { return; } + // check if tooltip exists and is not empty + if (!tooltip || !tooltip.html()) { return; } if (!positionTimeout) { positionTimeout = $timeout(function() { // Reset the positioning and box size for correct width and height values. - tooltip.css({ top: 0, left: 0, width: 'auto', height: 'auto' }); + tooltip.css({ top: 0, left: 0, width: 'auto', height: 'auto', visibility: 'hidden' }); var ttBox = $position.position(tooltip); var ttCss = $position.positionElements(element, tooltip, ttScope.placement, appendToBody); @@ -227,8 +229,6 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position']) ttScope.$apply(); // digest required as $apply is not called } - tooltip.css({ display: 'block', visibility: 'hidden' }); - positionTooltip(); }