Skip to content

Commit

Permalink
timeout the tooltip removal
Browse files Browse the repository at this point in the history
  • Loading branch information
nadersoliman committed Aug 24, 2015
1 parent efc93a8 commit 78e3a95
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ angular.module( 'mm.foundation.tooltip', [ 'mm.foundation.position', 'mm.foundat

// The options specified to the provider globally.
var globalOptions = {};

/**
* `options({})` allows global configuration of all tooltips in the
* application.
Expand Down Expand Up @@ -95,7 +95,7 @@ angular.module( 'mm.foundation.tooltip', [ 'mm.foundation.position', 'mm.foundat

var startSym = $interpolate.startSymbol();
var endSym = $interpolate.endSymbol();
var template =
var template =
'<div '+ directiveName +'-popup '+
'title="'+startSym+'tt_title'+endSym+'" '+
'content="'+startSym+'tt_content'+endSym+'" '+
Expand Down Expand Up @@ -220,7 +220,7 @@ angular.module( 'mm.foundation.tooltip', [ 'mm.foundation.position', 'mm.foundat
// Set the initial positioning.
tooltip.css({ top: 0, left: 0, display: 'block' });

// Now we add it to the DOM because need some info about it. But it's not
// Now we add it to the DOM because need some info about it. But it's not
// visible yet anyway.
if ( appendToBody ) {
$document.find( 'body' ).append( tooltip );
Expand All @@ -247,7 +247,7 @@ angular.module( 'mm.foundation.tooltip', [ 'mm.foundation.position', 'mm.foundat
//if tooltip is going to be shown after delay, we must cancel this
$timeout.cancel( popupTimeout );

// And now we remove it from the DOM. However, if we have animation, we
// And now we remove it from the DOM. However, if we have animation, we
// need to wait for it to expire beforehand.
// FIXME: this is a placeholder for a port of the transitions library.
if ( scope.tt_animation ) {
Expand All @@ -270,7 +270,10 @@ angular.module( 'mm.foundation.tooltip', [ 'mm.foundation.position', 'mm.foundat

function removeTooltip() {
if (tooltip) {
tooltip.remove();
var tt = tooltip;
$timeout(function(){
tt.remove();
});
tooltip = null;
}
}
Expand Down

0 comments on commit 78e3a95

Please sign in to comment.