]> source.dussan.org Git - jquery-ui.git/commitdiff
Autocomplete: Resize menu on every suggestion.
authorScott González <scott.gonzalez@gmail.com>
Thu, 11 Mar 2010 04:37:21 +0000 (04:37 +0000)
committerScott González <scott.gonzalez@gmail.com>
Thu, 11 Mar 2010 04:37:21 +0000 (04:37 +0000)
ui/jquery.ui.autocomplete.js

index 3cb031b1ea0c6919e326e0be88fa6020c7b0fbf0..8e46a00e86df13d139660cd485fbd2d8d023c0d8 100644 (file)
@@ -246,9 +246,10 @@ $.widget( "ui.autocomplete", {
                        of: this.element,
                        collision: "none"
                });
-               if ( ul.width() <= this.element.width() ) {
-                       ul.width( this.element.width() );
-               }
+
+               var menuWidth = ul.width( "" ).width(),
+                       textWidth = this.element.width();
+               ul.width( Math.max( menuWidth, textWidth ) );
        },
        
        _renderMenu: function( ul, items ) {