Skip to content

Commit d32a9e8

Browse files
committed
Tooltip: Mark target to prevent async results showing a tooltip that was closed already
1 parent daacbaf commit d32a9e8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ui/jquery.ui.tooltip.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,13 @@ $.widget( "ui.tooltip", {
103103
target.data( "tooltip-title", target.attr( "title" ) );
104104
}
105105

106+
target.data( "tooltip-open", true );
107+
106108
content = this.options.content.call( target[0], function( response ) {
109+
// ignore async response if tooltip was closed already
110+
if ( !target.data( "tooltip-open" ) ) {
111+
return;
112+
}
107113
// IE may instantly serve a cached response for ajax requests
108114
// delay this call to _open so the other call to _open runs first
109115
setTimeout(function() {
@@ -186,6 +192,7 @@ $.widget( "ui.tooltip", {
186192
delete that.tooltips[ this.id ];
187193
});
188194

195+
target.removeData( "tooltip-open" );
189196
target.unbind( "mouseleave.tooltip blur.tooltip keyup.tooltip" );
190197

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

0 commit comments

Comments
 (0)