aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2015-03-23 19:09:50 -0400
committerScott González <scott.gonzalez@gmail.com>2015-03-26 07:35:20 -0400
commit8cf98798a58afb7197bce0d6ca1c5b658ae04011 (patch)
tree4fe621f2141872f72caa423efdfd18565457cc11
parent899d90709a141ce22fedab2cfdf6044d9928f831 (diff)
downloadjquery-ui-8cf98798a58afb7197bce0d6ca1c5b658ae04011.tar.gz
jquery-ui-8cf98798a58afb7197bce0d6ca1c5b658ae04011.zip
Tooltip: Follow the standard appendTo logic
Even though there's no reason to ever configure the parent element via an `appendTo` option, following the standard logic is useful for scrollable elements and native dialogs. Fixes #10739 Closes gh-1517
-rw-r--r--ui/tooltip.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/ui/tooltip.js b/ui/tooltip.js
index ae1017722..841e877cc 100644
--- a/ui/tooltip.js
+++ b/ui/tooltip.js
@@ -428,7 +428,7 @@ $.widget( "ui.tooltip", {
this._addClass( content, "ui-tooltip-content" );
this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" );
- tooltip.appendTo( this.document[ 0 ].body );
+ tooltip.appendTo( this._appendTo( element ) );
return this.tooltips[ id ] = {
element: element,
@@ -446,6 +446,16 @@ $.widget( "ui.tooltip", {
delete this.tooltips[ tooltip.attr( "id" ) ];
},
+ _appendTo: function( target ) {
+ var element = target.closest( ".ui-front, dialog" );
+
+ if ( !element.length ) {
+ element = this.document[ 0 ].body;
+ }
+
+ return element;
+ },
+
_destroy: function() {
var that = this;