aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.autocomplete.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-12-14 09:10:32 -0500
committerScott González <scott.gonzalez@gmail.com>2012-12-14 09:10:32 -0500
commit80e46c93a84c8720cbd4aa206c46e4ac2a2d84f7 (patch)
tree3ad9699d732489711eaec9f1651ad4ee11ad8b1a /ui/jquery.ui.autocomplete.js
parent2c1643509aee3cdeb0b5b7cc86a3cfa5ceb9fb60 (diff)
downloadjquery-ui-80e46c93a84c8720cbd4aa206c46e4ac2a2d84f7.tar.gz
jquery-ui-80e46c93a84c8720cbd4aa206c46e4ac2a2d84f7.zip
Autocomplete: Append to closest .ui-front if available.
Diffstat (limited to 'ui/jquery.ui.autocomplete.js')
-rw-r--r--ui/jquery.ui.autocomplete.js20
1 files changed, 16 insertions, 4 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index a858b3382..65f702a28 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -23,7 +23,7 @@ $.widget( "ui.autocomplete", {
version: "@VERSION",
defaultElement: "<input>",
options: {
- appendTo: "body",
+ appendTo: null,
autoFocus: false,
delay: 300,
minLength: 1,
@@ -323,10 +323,22 @@ $.widget( "ui.autocomplete", {
_appendTo: function() {
var element = this.options.appendTo;
- if ( element && (element.jquery || element.nodeType) ) {
- return $( element );
+
+ if ( element ) {
+ element = element.jquery || element.nodeType ?
+ $( element ) :
+ this.document.find( element ).eq( 0 );
+ }
+
+ if ( !element ) {
+ element = this.element.closest( ".ui-front" );
}
- return this.document.find( element || "body" ).eq( 0 );
+
+ if ( !element.length ) {
+ element = this.document[0].body;
+ }
+
+ return element;
},
_isMultiLine: function() {