From 612838a1518c8cdc80b5bace5d925f89c1e791a3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 19 Jul 2010 09:28:04 -0400 Subject: [PATCH] Autocomplete: Added position option. Fixes #5153 - Autocomplete position option. --- .../unit/autocomplete/autocomplete_defaults.js | 7 ++++++- ui/jquery.ui.autocomplete.js | 17 ++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/unit/autocomplete/autocomplete_defaults.js b/tests/unit/autocomplete/autocomplete_defaults.js index c6017d62c..8dad15e8f 100644 --- a/tests/unit/autocomplete/autocomplete_defaults.js +++ b/tests/unit/autocomplete/autocomplete_defaults.js @@ -6,7 +6,12 @@ var autocomplete_defaults = { delay: 300, disabled: false, minLength: 1, - source: undefined + position: { + my: "left top", + at: "left bottom", + collision: "none" + }, + source: null }; commonWidgetTests('autocomplete', { defaults: autocomplete_defaults }); diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 3fa196ecb..1391643ba 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -16,8 +16,14 @@ $.widget( "ui.autocomplete", { options: { + delay: 300, minLength: 1, - delay: 300 + position: { + my: "left top", + at: "left bottom", + collision: "none" + }, + source: null }, _create: function() { var self = this, @@ -269,12 +275,9 @@ $.widget( "ui.autocomplete", { // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate this.menu.deactivate(); this.menu.refresh(); - this.menu.element.show().position({ - my: "left top", - at: "left bottom", - of: this.element, - collision: "none" - }); + this.menu.element.show().position( $.extend({ + of: this.element + }, this.options.position )); menuWidth = ul.width( "" ).outerWidth(); textWidth = this.element.outerWidth(); -- 2.39.5