]> source.dussan.org Git - jquery-ui.git/commitdiff
Tooltip: When calling the content response method multiple times, only update the...
authorScott González <scott.gonzalez@gmail.com>
Wed, 13 Jun 2012 09:18:48 +0000 (05:18 -0400)
committerScott González <scott.gonzalez@gmail.com>
Wed, 13 Jun 2012 09:18:48 +0000 (05:18 -0400)
ui/jquery.ui.tooltip.js

index 1892d65553945b8178bf1d3d0d835b3f46d4fa6f..752c9568735064498c2f989e23c8d32b4a2e906f 100644 (file)
@@ -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 ) )