diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-05-29 13:34:37 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-05-29 13:34:37 -0400 |
commit | 917d2b135891339cb02ce9cda5721faecae2a3ae (patch) | |
tree | b8954fb8ef2b6248c09e64c8c2b6d374c6731742 | |
parent | 0bc1c8cfdbbae9c80cb60e5d4a16581770e171bd (diff) | |
download | jquery-ui-917d2b135891339cb02ce9cda5721faecae2a3ae.tar.gz jquery-ui-917d2b135891339cb02ce9cda5721faecae2a3ae.zip |
Tooltip: Don't mess with the title attribute if it doesn't exist. Prevents the creation of a title attribute if there wasn't one to begin with.
-rw-r--r-- | ui/jquery.ui.tooltip.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index c8d892d38..c5d9508f7 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -81,7 +81,13 @@ $.widget( "ui.tooltip", { return; } - target.attr( "title", "" ); + // if we have a title, clear it to prevent the native tooltip + // we have to check first to avoid defining a title if none exists + // (we don't want to cause an element to start matching [title]) + // TODO: document why we don't use .removeAttr() + if ( target.is( "[title]" ) ) { + target.attr( "title", "" ); + } // TODO: why is this check after we clear the title? if ( this.options.disabled ) { @@ -120,7 +126,10 @@ $.widget( "ui.tooltip", { target = $( event ? event.currentTarget : this.element ), tooltip = this._find( target ); - target.attr( "title", target.data( "tooltip-title" ) ); + // only set title if we had one before (see comment in _open()) + if ( target.data( "tooltip-title" ) ) { + target.attr( "title", target.data( "tooltip-title" ) ); + } if ( this.options.disabled ) { return; |