diff options
author | Felix Nagel <info@felixnagel.com> | 2012-05-14 11:49:44 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2012-05-14 11:49:44 +0200 |
commit | 41dfb09aeb5df7d53089b58959d21207de63edbe (patch) | |
tree | 22053c8f7ddff61f3dfdaed028ef2e2d1a6b68c6 /ui/jquery.ui.tooltip.js | |
parent | ec5f2ae34ada562903b919d86221d03c9b193a0e (diff) | |
parent | 037db084f20d952558e4529a8b7394d562241a97 (diff) | |
download | jquery-ui-41dfb09aeb5df7d53089b58959d21207de63edbe.tar.gz jquery-ui-41dfb09aeb5df7d53089b58959d21207de63edbe.zip |
Merge branch 'master' into selectmenu
Diffstat (limited to 'ui/jquery.ui.tooltip.js')
-rw-r--r-- | ui/jquery.ui.tooltip.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index eddd9a0c9..97895a6a8 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Tooltip @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -99,7 +99,7 @@ $.widget( "ui.tooltip", { return; } - if ( !target.data( "ui-tooltip-title" ) ) { + if ( target.attr( "title" ) ) { target.data( "ui-tooltip-title", target.attr( "title" ) ); } @@ -159,7 +159,7 @@ $.widget( "ui.tooltip", { mouseleave: "close", focusout: "close", keyup: function( event ) { - if ( event.keyCode == $.ui.keyCode.ESCAPE ) { + if ( event.keyCode === $.ui.keyCode.ESCAPE ) { var fakeEvent = $.Event(event); fakeEvent.currentTarget = target[0]; this.close( fakeEvent, true ); @@ -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 ) { |