diff options
author | Alexander Schmitz <arschmitz@gmail.com> | 2015-08-24 08:50:46 -0400 |
---|---|---|
committer | Alexander Schmitz <arschmitz@gmail.com> | 2015-09-11 08:29:07 -0400 |
commit | a0892eca70b59238e40082cc7c2e5a042fb5bae9 (patch) | |
tree | 26c813093eb5df09797df2819b05957d046be884 /ui | |
parent | cfd48ed037db9a573a3495cb2fae773e3de9bb38 (diff) | |
download | jquery-ui-a0892eca70b59238e40082cc7c2e5a042fb5bae9.tar.gz jquery-ui-a0892eca70b59238e40082cc7c2e5a042fb5bae9.zip |
Tooltip: Style updates
Ref #14246
Diffstat (limited to 'ui')
-rw-r--r-- | ui/widgets/tooltip.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ui/widgets/tooltip.js b/ui/widgets/tooltip.js index 6c4493052..512224050 100644 --- a/ui/widgets/tooltip.js +++ b/ui/widgets/tooltip.js @@ -42,13 +42,16 @@ $.widget( "ui.tooltip", { "ui-tooltip": "ui-corner-all ui-widget-shadow" }, content: function() { + // support: IE<9, Opera in jQuery <1.7 // .text() can't accept undefined, so coerce to a string var title = $( this ).attr( "title" ) || ""; + // Escape title, since we're going from an attribute to raw HTML return $( "<a>" ).text( title ).html(); }, hide: true, + // Disabled elements have inconsistent behavior across browsers (#8661) items: "[title]:not([disabled])", position: { @@ -123,6 +126,7 @@ $.widget( "ui.tooltip", { if ( key === "disabled" ) { this[ value ? "_disable" : "_enable" ](); this.options[ key ] = value; + // disable element style changes return; } @@ -158,6 +162,7 @@ $.widget( "ui.tooltip", { }, _enable: function() { + // restore title attributes this.element.find( this.options.items ).addBack().each( function() { var element = $( this ); @@ -170,6 +175,7 @@ $.widget( "ui.tooltip", { open: function( event ) { var that = this, target = $( event ? event.target : this.element ) + // we need closest here due to mouseover bubbling, // but always pointing at the same event target .closest( this.options.items ); @@ -304,6 +310,7 @@ $.widget( "ui.tooltip", { this._on( this.document, { mousemove: position } ); + // trigger once to override element-relative positioning position( event ); } else { @@ -315,6 +322,7 @@ $.widget( "ui.tooltip", { tooltip.hide(); this._show( tooltip, this.options.show ); + // Handle tracking tooltips that are shown with a delay (#8644). As soon // as the tooltip is visible, position the tooltip using the most recent // event. @@ -464,6 +472,7 @@ $.widget( "ui.tooltip", { // Close open tooltips $.each( this.tooltips, function( id, tooltipData ) { + // Delegate to close method to handle common cleanup var event = $.Event( "blur" ), element = tooltipData.element; @@ -476,6 +485,7 @@ $.widget( "ui.tooltip", { // Restore the title if ( 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" ) ); |