diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-03-29 18:36:38 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-03-29 18:36:38 -0400 |
commit | 56de22eeadb5882ad1d78a207b9fb69247e233ee (patch) | |
tree | b9bce9647813b370e76ad9978d932689164928b2 | |
parent | a51451dc1b19bf6c2e10b1648b57d006bf38c303 (diff) | |
download | jquery-ui-56de22eeadb5882ad1d78a207b9fb69247e233ee.tar.gz jquery-ui-56de22eeadb5882ad1d78a207b9fb69247e233ee.zip |
Tooltip: Avoid infinite recursion when disabling a tooltip on close.
-rw-r--r-- | ui/jquery.ui.tooltip.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index eddd9a0c9..dd0a746d3 100644 --- a/ui/jquery.ui.tooltip.js +++ b/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 ) { |