Skip to content

Commit e8b6232

Browse files
committed
Tooltip: When calling the content response method multiple times, only update the content, don't do any other processing.
1 parent a47f5dc commit e8b6232

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

ui/jquery.ui.tooltip.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ $.widget( "ui.tooltip", {
149149
return;
150150
}
151151

152+
// Content can be updated multiple times. If the tooltip already
153+
// exists, then just update the content and bail.
154+
var tooltip = this._find( target );
155+
if ( tooltip.length ) {
156+
tooltip.find( ".ui-tooltip-content" ).html( content );
157+
return;
158+
}
159+
152160
// if we have a title, clear it to prevent the native tooltip
153161
// we have to check first to avoid defining a title if none exists
154162
// (we don't want to cause an element to start matching [title])
@@ -164,15 +172,10 @@ $.widget( "ui.tooltip", {
164172
}
165173
}
166174

167-
// ajaxy tooltip can update an existing one
168-
var tooltip = this._find( target );
169-
if ( !tooltip.length ) {
170-
tooltip = this._tooltip( target );
171-
addDescribedBy( target, tooltip.attr( "id" ) );
172-
}
175+
tooltip = this._tooltip( target );
176+
addDescribedBy( target, tooltip.attr( "id" ) );
173177
tooltip.find( ".ui-tooltip-content" ).html( content );
174178
tooltip
175-
.stop( true )
176179
.position( $.extend({
177180
of: target
178181
}, this.options.position ) )

0 commit comments

Comments
 (0)