Skip to content

Commit 85d6acb

Browse files
committed
Selectmenu: merged _toggleButtonStyle with _toggleAttr method, removed incomplete dropdown _setOptions functionality
1 parent a4eeddd commit 85d6acb

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

ui/jquery.ui.selectmenu.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ $.widget( "ui.selectmenu", {
161161
.attr( 'role', 'listbox' );
162162

163163
// change menu styles?
164-
this._setOption( "dropdown", this.options.dropdown );
164+
if ( this.options.dropdown ) {
165+
this.menu.addClass( 'ui-corner-bottom' ).removeClass( 'ui-corner-all' );
166+
}
165167

166168
// unbind Menu document event
167169
$( document ).unbind( "click.menu" );
@@ -193,8 +195,6 @@ $.widget( "ui.selectmenu", {
193195

194196
open: function( event ) {
195197
if ( !this.options.disabled ) {
196-
this._toggleButtonStyle();
197-
198198
// make sure menu is refreshed on first init (needed at least for IE9)
199199
if ( this.isOpen === undefined ) {
200200
this.button.trigger( "focus" );
@@ -232,7 +232,6 @@ $.widget( "ui.selectmenu", {
232232

233233
close: function( event ) {
234234
if ( this.isOpen ) {
235-
this._toggleButtonStyle();
236235
this._toggleAttr();
237236
this.isOpen = false;
238237
this._trigger( "close", event );
@@ -389,9 +388,6 @@ $.widget( "ui.selectmenu", {
389388
if ( key === "appendTo" ) {
390389
this.menuWrap.appendTo( $( value || "body", this.element[0].ownerDocument )[0] );
391390
}
392-
if ( key === "dropdown" ) {
393-
this.menu.toggleClass( 'ui-corner-bottom', value ).toggleClass( 'ui-corner-all', !value );
394-
}
395391
if ( key === "disabled" ) {
396392
this.menu.menu( "option", "disabled", value );
397393
if ( value ) {
@@ -406,17 +402,14 @@ $.widget( "ui.selectmenu", {
406402
},
407403

408404
_toggleAttr: function(){
409-
this.menuWrap.toggleClass( 'ui-selectmenu-open', !this.isOpen );
410-
this.menu.attr("aria-hidden", this.isOpen);
411-
this.button.attr("aria-expanded", !this.isOpen);
412-
},
413-
414-
_toggleButtonStyle: function() {
415405
if ( this.options.dropdown ) {
416406
this.button.toggleClass( 'ui-corner-top', !this.isOpen ).toggleClass( 'ui-corner-all', this.isOpen );
417407
}
408+
this.menuWrap.toggleClass( 'ui-selectmenu-open', !this.isOpen );
409+
this.menu.attr("aria-hidden", this.isOpen);
410+
this.button.attr("aria-expanded", !this.isOpen);
418411
},
419-
412+
420413
_getCreateOptions: function() {
421414
return { disabled: !!this.element.attr( 'disabled' ) };
422415
},

0 commit comments

Comments
 (0)