Skip to content
Permalink
Browse files

Tooltip: Avoid infinite recursion when disabling a tooltip on close.

  • Loading branch information
scottgonzalez committed Mar 29, 2012
1 parent a51451d commit 56de22eeadb5882ad1d78a207b9fb69247e233ee
Showing with 8 additions and 0 deletions.
  1. +8 −0 ui/jquery.ui.tooltip.js
@@ -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 ) {

0 comments on commit 56de22e

Please sign in to comment.
You can’t perform that action at this time.