diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-10-05 12:52:02 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-10-05 12:52:02 -0400 |
commit | 0a31a828319493d6642ce876555e5383106ce039 (patch) | |
tree | 63a9c05a5233f6e4a5df147c466de559324687f0 /ui | |
parent | 96f2aa4c72b5f29782b0736ed95468e50d338d6e (diff) | |
download | jquery-ui-0a31a828319493d6642ce876555e5383106ce039.tar.gz jquery-ui-0a31a828319493d6642ce876555e5383106ce039.zip |
Tooltip: Better cleanup on destroy. Fixes #8627 - The Tooltip destroy method is not clearing up the data properties.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.tooltip.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 32aad6487..980b43868 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -317,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" ); + } }); } }); |