Skip to content

Commit 0dc84db

Browse files
mwiencekjzaefferer
authored andcommitted
Tooltip: Preserve the title after disabling twice
Fixes #9719 Closes jquerygh-1154
1 parent 9413043 commit 0dc84db

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tests/unit/tooltip/tooltip_methods.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ test( "open/close with tracking", function() {
5454
});
5555

5656
test( "enable/disable", function() {
57-
expect( 10 );
57+
expect( 11 );
5858
$.fx.off = true;
5959
var tooltip,
6060
element = $( "#tooltipped1" ).tooltip();
@@ -82,6 +82,12 @@ test( "enable/disable", function() {
8282
element.tooltip( "enable" );
8383
equal( element.attr( "title" ), "anchortitle", "title restored on enable" );
8484

85+
// #9719 - Title should be preserved after disabling twice
86+
element.tooltip( "disable" );
87+
element.tooltip( "disable" );
88+
element.tooltip( "enable" );
89+
equal( element.attr( "title" ), "anchortitle", "title restored on enable after being disabled twice" );
90+
8591
element.tooltip( "open" );
8692
tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
8793
ok( tooltip.is( ":visible" ) );

ui/jquery.ui.tooltip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ $.widget( "ui.tooltip", {
129129
if ( element.is( "[title]" ) ) {
130130
element
131131
.data( "ui-tooltip-title", element.attr( "title" ) )
132-
.attr( "title", "" );
132+
.removeAttr( "title" );
133133
}
134134
});
135135
},

0 commit comments

Comments
 (0)