Skip to content

Commit a0c8564

Browse files
committed
Autocomplete: Split menu resizing logic into its own method to create a more logical method to proxy for custom sizing.
1 parent 6ba75aa commit a0c8564

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

ui/jquery.ui.autocomplete.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,8 @@ $.widget( "ui.autocomplete", {
326326

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

341-
menuWidth = ul.width( "" ).outerWidth();
342-
textWidth = this.element.outerWidth();
343-
ul.outerWidth( Math.max( menuWidth, textWidth ) );
339+
this._resizeMenu();
340+
},
341+
342+
_resizeMenu: function() {
343+
var ul = this.menu.element;
344+
ul.outerWidth( Math.max(
345+
ul.width( "" ).outerWidth(),
346+
this.element.outerWidth()
347+
) );
344348
},
345349

346350
_renderMenu: function( ul, items ) {

0 commit comments

Comments
 (0)