diff options
author | Scott González <scott.gonzalez@gmail.com> | 2015-03-23 19:09:50 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2016-06-09 13:19:31 -0400 |
commit | 977b33625be3dd0959bf5b1272f2f192471794cf (patch) | |
tree | f4ef760ffa239257f6bdf2cd0c239cf46f390cb1 | |
parent | f6379dc65548e9770b53f29bfa901576a38064ec (diff) | |
download | jquery-ui-977b33625be3dd0959bf5b1272f2f192471794cf.tar.gz jquery-ui-977b33625be3dd0959bf5b1272f2f192471794cf.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
(cherry picked from commit 8cf98798a58afb7197bce0d6ca1c5b658ae04011)
-rw-r--r-- | ui/tooltip.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ui/tooltip.js b/ui/tooltip.js index 8408f6781..23446ae65 100644 --- a/ui/tooltip.js +++ b/ui/tooltip.js @@ -424,7 +424,7 @@ return $.widget( "ui.tooltip", { .addClass( "ui-tooltip-content" ) .appendTo( tooltip ); - tooltip.appendTo( this.document[0].body ); + tooltip.appendTo( this._appendTo( element ) ); return this.tooltips[ id ] = { element: element, @@ -442,6 +442,16 @@ return $.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; |