Tooltip: Preserve the title after disabling twice

Fixes #9719
Closes gh-1154
This commit is contained in:
Michael Wiencek 2013-12-23 20:40:30 -06:00 committed by Jörn Zaefferer
parent 9413043a9e
commit 0dc84db853
2 changed files with 8 additions and 2 deletions

View File

@ -54,7 +54,7 @@ test( "open/close with tracking", function() {
}); });
test( "enable/disable", function() { test( "enable/disable", function() {
expect( 10 ); expect( 11 );
$.fx.off = true; $.fx.off = true;
var tooltip, var tooltip,
element = $( "#tooltipped1" ).tooltip(); element = $( "#tooltipped1" ).tooltip();
@ -82,6 +82,12 @@ test( "enable/disable", function() {
element.tooltip( "enable" ); element.tooltip( "enable" );
equal( element.attr( "title" ), "anchortitle", "title restored on enable" ); equal( element.attr( "title" ), "anchortitle", "title restored on enable" );
// #9719 - Title should be preserved after disabling twice
element.tooltip( "disable" );
element.tooltip( "disable" );
element.tooltip( "enable" );
equal( element.attr( "title" ), "anchortitle", "title restored on enable after being disabled twice" );
element.tooltip( "open" ); element.tooltip( "open" );
tooltip = $( "#" + element.data( "ui-tooltip-id" ) ); tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
ok( tooltip.is( ":visible" ) ); ok( tooltip.is( ":visible" ) );

View File

@ -129,7 +129,7 @@ $.widget( "ui.tooltip", {
if ( element.is( "[title]" ) ) { if ( element.is( "[title]" ) ) {
element element
.data( "ui-tooltip-title", element.attr( "title" ) ) .data( "ui-tooltip-title", element.attr( "title" ) )
.attr( "title", "" ); .removeAttr( "title" );
} }
}); });
}, },