mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Autocomplete: Split menu resizing logic into its own method to create a more logical method to proxy for custom sizing.
This commit is contained in:
parent
6ba75aa698
commit
a0c856467d
18
ui/jquery.ui.autocomplete.js
vendored
18
ui/jquery.ui.autocomplete.js
vendored
@ -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();
|
||||
@ -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 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user