diff options
author | Felix Nagel <info@felixnagel.com> | 2012-10-12 22:56:45 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2012-10-12 22:56:45 +0200 |
commit | c59fbbaad74f7bee73b57985570f689c9a5d9383 (patch) | |
tree | 89209c996ac48c84a0ce20e77061eaef04f87d6c /ui/jquery.ui.tooltip.js | |
parent | fc729a8c8ebfbe9c05f8b1ebbd6629898f3fc6c0 (diff) | |
parent | 94221c4e5b11496ef927889e1541d84b5746fb31 (diff) | |
download | jquery-ui-c59fbbaad74f7bee73b57985570f689c9a5d9383.tar.gz jquery-ui-c59fbbaad74f7bee73b57985570f689c9a5d9383.zip |
Merge branch 'master' into selectmenu
Diffstat (limited to 'ui/jquery.ui.tooltip.js')
-rw-r--r-- | ui/jquery.ui.tooltip.js | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index f38379f21..980b43868 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -140,6 +140,8 @@ $.widget( "ui.tooltip", { this._find( target ).position( $.extend({ of: target }, this.options.position ) ); + // Stop tracking (#8622) + this._off( this.document, "mousemove" ); return; } @@ -214,7 +216,7 @@ $.widget( "ui.tooltip", { positionOption.of = event; tooltip.position( positionOption ); } - if ( this.options.track && /^mouse/.test( event.originalEvent.type ) ) { + if ( this.options.track && event && /^mouse/.test( event.originalEvent.type ) ) { positionOption = $.extend( {}, this.options.position ); this._on( this.document, { mousemove: position @@ -315,8 +317,24 @@ $.widget( "ui.tooltip", { }, _destroy: function() { - $.each( this.tooltips, function( id ) { + var that = this; + + // close open tooltips + $.each( this.tooltips, function( id, element ) { + // Delegate to close method to handle common cleanup + var event = $.Event( "blur" ); + event.target = event.currentTarget = element[0]; + that.close( event, true ); + + // Remove immediately; destroying an open tooltip doesn't use the + // hide animation $( "#" + id ).remove(); + + // Restore the title + if ( element.data( "ui-tooltip-title" ) ) { + element.attr( "title", element.data( "ui-tooltip-title" ) ); + element.removeData( "ui-tooltip-title" ); + } }); } }); |