Navigation Menu

Skip to content

Commit

Permalink
Autocomplete: Split menu resizing logic into its own method to create…
Browse files Browse the repository at this point in the history
… a more logical method to proxy for custom sizing.
  • Loading branch information
scottgonzalez committed Oct 22, 2010
1 parent 6ba75aa commit a0c8564
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions ui/jquery.ui.autocomplete.js
Expand Up @@ -326,10 +326,8 @@ $.widget( "ui.autocomplete", {

_suggest: function( items ) {
var ul = this.menu.element
.empty()
.zIndex( this.element.zIndex() + 1 ),
menuWidth,
textWidth;
.empty()
.zIndex( this.element.zIndex() + 1 );
this._renderMenu( ul, items );
// TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
this.menu.deactivate();
Expand All @@ -338,9 +336,15 @@ $.widget( "ui.autocomplete", {
of: this.element
}, this.options.position ));

menuWidth = ul.width( "" ).outerWidth();
textWidth = this.element.outerWidth();
ul.outerWidth( Math.max( menuWidth, textWidth ) );
this._resizeMenu();
},

_resizeMenu: function() {
var ul = this.menu.element;
ul.outerWidth( Math.max(
ul.width( "" ).outerWidth(),
this.element.outerWidth()
) );
},

_renderMenu: function( ul, items ) {
Expand Down

0 comments on commit a0c8564

Please sign in to comment.