Skip to content

Commit

Permalink
Tooltip: Mark target to prevent async results showing a tooltip that …
Browse files Browse the repository at this point in the history
…was closed already
  • Loading branch information
jzaefferer committed Feb 19, 2012
1 parent daacbaf commit d32a9e8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ui/jquery.ui.tooltip.js
Expand Up @@ -103,7 +103,13 @@ $.widget( "ui.tooltip", {
target.data( "tooltip-title", target.attr( "title" ) );
}

target.data( "tooltip-open", true );

content = this.options.content.call( target[0], function( response ) {
// ignore async response if tooltip was closed already
if ( !target.data( "tooltip-open" ) ) {
return;
}
// IE may instantly serve a cached response for ajax requests
// delay this call to _open so the other call to _open runs first
setTimeout(function() {
Expand Down Expand Up @@ -186,6 +192,7 @@ $.widget( "ui.tooltip", {
delete that.tooltips[ this.id ];
});

target.removeData( "tooltip-open" );
target.unbind( "mouseleave.tooltip blur.tooltip keyup.tooltip" );

this._trigger( "close", event, { tooltip: tooltip } );
Expand Down

0 comments on commit d32a9e8

Please sign in to comment.