diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-12-14 09:10:32 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-12-14 09:10:32 -0500 |
commit | 80e46c93a84c8720cbd4aa206c46e4ac2a2d84f7 (patch) | |
tree | 3ad9699d732489711eaec9f1651ad4ee11ad8b1a /ui/jquery.ui.autocomplete.js | |
parent | 2c1643509aee3cdeb0b5b7cc86a3cfa5ceb9fb60 (diff) | |
download | jquery-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.js | 20 |
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() { |