@@ -24,11 +24,12 @@ $.widget("ui.selectmenu", {
2424 } ,
2525 width : null ,
2626 menuWidth : null ,
27- handleWidth : 26 ,
27+ handleWidth : 26 ,
2828 maxHeight : null ,
2929 icons : null ,
3030 format : null ,
31- bgImage : function ( ) { }
31+ bgImage : function ( ) { } ,
32+ wrapperElement : ""
3233 } ,
3334
3435 _create : function ( ) {
@@ -46,7 +47,8 @@ $.widget("ui.selectmenu", {
4647 //create menu button wrapper
4748 this . newelement = $ ( '<a class="' + this . widgetBaseClass + ' ui-widget ui-state-default ui-corner-all" id="' + this . ids [ 0 ] + '" role="button" href="#" tabindex="0" aria-haspopup="true" aria-owns="' + this . ids [ 1 ] + '"></a>' )
4849 . insertAfter ( this . element ) ;
49-
50+ //
51+ this . newelement . wrap ( o . wrapperElement ) ;
5052 //transfer tabindex
5153 var tabindex = this . element . attr ( 'tabindex' ) ;
5254 if ( tabindex ) { this . newelement . attr ( 'tabindex' , tabindex ) ; }
@@ -133,6 +135,7 @@ $.widget("ui.selectmenu", {
133135 //create menu portion, append to body
134136 var cornerClass = ( o . style == "dropdown" ) ? " ui-corner-bottom" : " ui-corner-all" ;
135137 this . list = $ ( '<ul class="' + self . widgetBaseClass + '-menu ui-widget ui-widget-content' + cornerClass + '" aria-hidden="true" role="listbox" aria-labelledby="' + this . ids [ 0 ] + '" id="' + this . ids [ 1 ] + '"></ul>' ) . appendTo ( 'body' ) ;
138+ this . list . wrap ( o . wrapperElement ) ;
136139
137140 //serialize selectmenu element options
138141 var selectOptionData = [ ] ;
@@ -350,6 +353,7 @@ $.widget("ui.selectmenu", {
350353 . attr ( 'for' , this . element . attr ( 'id' ) )
351354 . unbind ( 'click' ) ;
352355 this . newelement . remove ( ) ;
356+ // FIXME option.wrapper needs
353357 this . list . remove ( ) ;
354358 this . element . show ( ) ;
355359
@@ -397,10 +401,12 @@ $.widget("ui.selectmenu", {
397401 this . _closeOthers ( event ) ;
398402 this . newelement
399403 . addClass ( 'ui-state-active' ) ;
400-
401- this . list
402- . appendTo ( 'body' )
403- . addClass ( self . widgetBaseClass + '-open' )
404+ if ( self . options . wrapperElement ) {
405+ this . list . parent ( ) . appendTo ( 'body' ) ;
406+ } else {
407+ this . list . appendTo ( 'body' ) ;
408+ }
409+ this . list . addClass ( self . widgetBaseClass + '-open' )
404410 . attr ( 'aria-hidden' , false )
405411 . find ( 'li:not(.' + self . widgetBaseClass + '-group):eq(' + this . _selectedIndex ( ) + ') a' ) [ 0 ] . focus ( ) ;
406412 if ( this . options . style == "dropdown" ) { this . newelement . removeClass ( 'ui-corner-all' ) . addClass ( 'ui-corner-top' ) ; }
0 commit comments