aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.autocomplete.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/jquery.ui.autocomplete.js')
-rw-r--r--ui/jquery.ui.autocomplete.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index f2a7089c4..5edb84d44 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -181,7 +181,7 @@ $.widget( "ui.autocomplete", {
this._initSource();
this.menu = $( "<ul>" )
.addClass( "ui-autocomplete" )
- .appendTo( this.document.find( this.options.appendTo || "body" )[ 0 ] )
+ .appendTo( this._appendTo() )
.menu({
// custom key handling for now
input: $(),
@@ -320,6 +320,14 @@ $.widget( "ui.autocomplete", {
}
},
+ _appendTo: function() {
+ var element = this.options.appendTo;
+ if ( element && (element.jquery || element.nodeType) ) {
+ return $( element );
+ }
+ return this.document.find( element || "body" ).eq( 0 );
+ },
+
_isMultiLine: function() {
// Textareas are always multi-line
if ( this.element.is( "textarea" ) ) {