aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-06-13 05:18:48 -0400
committerScott González <scott.gonzalez@gmail.com>2012-06-13 05:18:48 -0400
commite8b623207abcae500ffb3860378543906cd4e2b2 (patch)
treede6071d9e6cbecadef9cc67fbd9e5937d41e4604
parenta47f5dc4f21762126ff460af9f49dffeb36e4086 (diff)
downloadjquery-ui-e8b623207abcae500ffb3860378543906cd4e2b2.tar.gz
jquery-ui-e8b623207abcae500ffb3860378543906cd4e2b2.zip
Tooltip: When calling the content response method multiple times, only update the content, don't do any other processing.
-rw-r--r--ui/jquery.ui.tooltip.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js
index 1892d6555..752c95687 100644
--- a/ui/jquery.ui.tooltip.js
+++ b/ui/jquery.ui.tooltip.js
@@ -149,6 +149,14 @@ $.widget( "ui.tooltip", {
return;
}
+ // Content can be updated multiple times. If the tooltip already
+ // exists, then just update the content and bail.
+ var tooltip = this._find( target );
+ if ( tooltip.length ) {
+ tooltip.find( ".ui-tooltip-content" ).html( content );
+ return;
+ }
+
// if we have a title, clear it to prevent the native tooltip
// we have to check first to avoid defining a title if none exists
// (we don't want to cause an element to start matching [title])
@@ -164,15 +172,10 @@ $.widget( "ui.tooltip", {
}
}
- // ajaxy tooltip can update an existing one
- var tooltip = this._find( target );
- if ( !tooltip.length ) {
- tooltip = this._tooltip( target );
- addDescribedBy( target, tooltip.attr( "id" ) );
- }
+ tooltip = this._tooltip( target );
+ addDescribedBy( target, tooltip.attr( "id" ) );
tooltip.find( ".ui-tooltip-content" ).html( content );
tooltip
- .stop( true )
.position( $.extend({
of: target
}, this.options.position ) )