]> source.dussan.org Git - jquery-ui.git/commitdiff
Tooltip: Avoid infinite recursion when disabling a tooltip on close.
authorScott González <scott.gonzalez@gmail.com>
Thu, 29 Mar 2012 22:36:38 +0000 (18:36 -0400)
committerScott González <scott.gonzalez@gmail.com>
Thu, 29 Mar 2012 22:36:38 +0000 (18:36 -0400)
ui/jquery.ui.tooltip.js

index eddd9a0c96ecf9d48358e58fb6ab8d0675a794ee..dd0a746d3e52d1bdfc6860f8d8724ae307cc9ef1 100644 (file)
@@ -173,6 +173,12 @@ $.widget( "ui.tooltip", {
                        target = $( event ? event.currentTarget : this.element ),
                        tooltip = this._find( target );
 
+               // disabling closes the tooltip, so we need to track when we're closing
+               // to avoid an infinite loop in case the tooltip becomes disabled on close
+               if ( this.closing ) {
+                       return;
+               }
+
                // don't close if the element has focus
                // this prevents the tooltip from closing if you hover while focused
                if ( !force && this.document[0].activeElement === target[0] ) {
@@ -195,7 +201,9 @@ $.widget( "ui.tooltip", {
                target.removeData( "tooltip-open" );
                target.unbind( "mouseleave.tooltip focusout.tooltip keyup.tooltip" );
 
+               this.closing = true;
                this._trigger( "close", event, { tooltip: tooltip } );
+               this.closing = false;
        },
 
        _tooltip: function( element ) {