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 8cf98798a5)
This commit is contained in:
Scott González 2015-03-23 19:09:50 -04:00
parent f6379dc655
commit 977b33625b

View File

@ -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;