aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-07-21 14:54:20 -0400
committerScott González <scott.gonzalez@gmail.com>2010-07-21 14:54:20 -0400
commit74e0d4f47301ff854ec741434da1351544a1a55d (patch)
tree4e1f72f466b488f3964824c0cf37fddc118e6278 /ui
parent245b93293335e916771aa78363e83f244b43de7a (diff)
downloadjquery-ui-74e0d4f47301ff854ec741434da1351544a1a55d.tar.gz
jquery-ui-74e0d4f47301ff854ec741434da1351544a1a55d.zip
Autocomplete: Added appendTo option. Fixes #5836 - Autocomplete: add appendTo option.
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.autocomplete.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index 4b37a000d..0849ba7eb 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -16,6 +16,7 @@
$.widget( "ui.autocomplete", {
options: {
+ appendTo: "body",
delay: 300,
minLength: 1,
position: {
@@ -104,7 +105,7 @@ $.widget( "ui.autocomplete", {
};
this.menu = $( "<ul></ul>" )
.addClass( "ui-autocomplete" )
- .appendTo( "body", doc )
+ .appendTo( $( this.options.appendTo || "body", doc )[0] )
// prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)
.mousedown(function() {
// use another timeout to make sure the blur-event-handler on the input was already triggered
@@ -166,11 +167,14 @@ $.widget( "ui.autocomplete", {
$.Widget.prototype.destroy.call( this );
},
- _setOption: function( key ) {
+ _setOption: function( key, value ) {
$.Widget.prototype._setOption.apply( this, arguments );
if ( key === "source" ) {
this._initSource();
}
+ if ( key === "appendTo" ) {
+ this.menu.element.appendTo( $( value || "body", this.element.ownerDocument )[0] )
+ }
},
_initSource: function() {