aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDaniel DeGroff <djdegroff@gmail.com>2013-12-02 22:03:55 -0600
committerJörn Zaefferer <joern.zaefferer@gmail.com>2014-01-06 16:10:02 +0100
commitaf85dfcafb32b7503392ca834eaa9d3162d54b28 (patch)
tree9f01beeb1794a9df54d38a64bf00b4b23f7a5d7f /ui
parentb9e438d07c370ac2d4b198048feb6b6922469f70 (diff)
downloadjquery-ui-af85dfcafb32b7503392ca834eaa9d3162d54b28.tar.gz
jquery-ui-af85dfcafb32b7503392ca834eaa9d3162d54b28.zip
Tooltip: On close and destroy only set title if empty or undefined
Ticket #8925 states that changes to the title attribute while the tooltip is open are lost on tooltip close. In the close and destroy functions, the title attribute is always written if a value was stored in the element on open. It is possible the attribute has changed and restoring the initial value may overwrite the current value. If the value is empty or undefined as set in open, do not set the title attribute. This fix has the limitation that if the user removed the title attribute or set the value to an empty string the original title value would be restored on close and destroy. Fixes #8925
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.tooltip.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js
index 1ebe1a958..6854032f4 100644
--- a/ui/jquery.ui.tooltip.js
+++ b/ui/jquery.ui.tooltip.js
@@ -339,7 +339,8 @@ $.widget( "ui.tooltip", {
clearInterval( this.delayedShow );
// only set title if we had one before (see comment in _open())
- if ( target.data( "ui-tooltip-title" ) ) {
+ // If the title attribute has changed since open(), don't restore
+ if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
target.attr( "title", target.data( "ui-tooltip-title" ) );
}
@@ -412,7 +413,10 @@ $.widget( "ui.tooltip", {
// Restore the title
if ( element.data( "ui-tooltip-title" ) ) {
- element.attr( "title", element.data( "ui-tooltip-title" ) );
+ // If the title attribute has changed since open(), don't restore
+ if ( !element.attr( "title" ) ) {
+ element.attr( "title", element.data( "ui-tooltip-title" ) );
+ }
element.removeData( "ui-tooltip-title" );
}
});