@@ -161,7 +161,9 @@ $.widget( "ui.selectmenu", {
161
161
. attr ( 'role' , 'listbox' ) ;
162
162
163
163
// 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
+ }
165
167
166
168
// unbind Menu document event
167
169
$ ( document ) . unbind ( "click.menu" ) ;
@@ -193,8 +195,6 @@ $.widget( "ui.selectmenu", {
193
195
194
196
open : function ( event ) {
195
197
if ( ! this . options . disabled ) {
196
- this . _toggleButtonStyle ( ) ;
197
-
198
198
// make sure menu is refreshed on first init (needed at least for IE9)
199
199
if ( this . isOpen === undefined ) {
200
200
this . button . trigger ( "focus" ) ;
@@ -232,7 +232,6 @@ $.widget( "ui.selectmenu", {
232
232
233
233
close : function ( event ) {
234
234
if ( this . isOpen ) {
235
- this . _toggleButtonStyle ( ) ;
236
235
this . _toggleAttr ( ) ;
237
236
this . isOpen = false ;
238
237
this . _trigger ( "close" , event ) ;
@@ -389,9 +388,6 @@ $.widget( "ui.selectmenu", {
389
388
if ( key === "appendTo" ) {
390
389
this . menuWrap . appendTo ( $ ( value || "body" , this . element [ 0 ] . ownerDocument ) [ 0 ] ) ;
391
390
}
392
- if ( key === "dropdown" ) {
393
- this . menu . toggleClass ( 'ui-corner-bottom' , value ) . toggleClass ( 'ui-corner-all' , ! value ) ;
394
- }
395
391
if ( key === "disabled" ) {
396
392
this . menu . menu ( "option" , "disabled" , value ) ;
397
393
if ( value ) {
@@ -406,17 +402,14 @@ $.widget( "ui.selectmenu", {
406
402
} ,
407
403
408
404
_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 ( ) {
415
405
if ( this . options . dropdown ) {
416
406
this . button . toggleClass ( 'ui-corner-top' , ! this . isOpen ) . toggleClass ( 'ui-corner-all' , this . isOpen ) ;
417
407
}
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 ) ;
418
411
} ,
419
-
412
+
420
413
_getCreateOptions : function ( ) {
421
414
return { disabled : ! ! this . element . attr ( 'disabled' ) } ;
422
415
} ,
0 commit comments