Skip to content

Commit

Permalink
Merge pull request #1 from nadersoliman/timeout_tooltip_removal
Browse files Browse the repository at this point in the history
timeout the tooltip removal
  • Loading branch information
nadersoliman committed Aug 24, 2015
2 parents ab9542f + 78e3a95 commit 176fc88
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 176fc88

Please sign in to comment.