@@ -38,7 +38,8 @@ return $.widget( "ui.controlgroup", {
3838 items : {
3939 "button" : "input[type=button], input[type=submit], input[type=reset], button, a" ,
4040 "checkboxradio" : "input[type='checkbox'], input[type='radio']" ,
41- "selectmenu" : "select"
41+ "selectmenu" : "select" ,
42+ "spinner" : ".ui-spinner-input"
4243 } ,
4344 direction : "horizontal" ,
4445 excludeInvisible : true
@@ -83,14 +84,13 @@ return $.widget( "ui.controlgroup", {
8384
8485 // Don't set data or add to the collection if the method is destroy
8586 widgets . each ( function ( ) {
87+ var element = $ ( this ) ;
8688
8789 // Set data on the widget element pointing to the this.element of the widget
8890 // and telling us what type of widget this is
8991 var widgetElement =
90- $ ( this ) [ widget ] ( "widget" ) . data ( "ui-controlgroup-data" , {
91- "widgetType" : widget ,
92- "element" : $ ( this )
93- } ) ;
92+ element [ widget ] ( "widget" ) . data ( "ui-controlgroup-data" , element . data ( "ui-" +
93+ widget . charAt ( 0 ) . toUpperCase ( ) + widget . slice ( 1 ) ) ) ;
9494
9595 childWidgets . push ( widgetElement [ 0 ] ) ;
9696 } ) ;
@@ -104,8 +104,9 @@ return $.widget( "ui.controlgroup", {
104104 this . childWidgets . each ( function ( ) {
105105 var element = $ ( this ) ,
106106 data = element . data ( "ui-controlgroup-data" ) ;
107-
108- data . element [ data . widgetType ] ( method ) ;
107+ if ( data [ method ] ) {
108+ data [ method ] ( ) ;
109+ }
109110 } ) ;
110111 } ,
111112
@@ -122,6 +123,15 @@ return $.widget( "ui.controlgroup", {
122123 return result ;
123124 } ,
124125
126+ _spinner_options : function ( position , direction ) {
127+ var options = this . _buildSimpleOptions ( position , direction , "ui-spinner" ) ;
128+
129+ options . classes [ "ui-spinner-up" ] = "" ;
130+ options . classes [ "ui-spinner-down" ] = "" ;
131+
132+ return options ;
133+ } ,
134+
125135 _button_options : function ( position , direction ) {
126136 return this . _buildSimpleOptions ( position , direction , "ui-button" ) ;
127137 } ,
@@ -191,11 +201,12 @@ return $.widget( "ui.controlgroup", {
191201
192202 // We do this last because we need to make sure all enhancment is done
193203 // before determining first and last
194- [ "first" , "last" ] . forEach ( function ( value ) {
195- var data = children [ value ] ( ) . data ( "ui-controlgroup-data" ) ;
196- if ( that [ "_" + data . widgetType + "_options" ] ) {
197- data . element [ data . widgetType ] (
198- that [ "_" + data . widgetType + "_options" ] (
204+ $ . each ( [ "first" , "last" ] , function ( index , value ) {
205+ var instance = children [ value ] ( ) . data ( "ui-controlgroup-data" ) ;
206+ console . log ( instance )
207+ if ( that [ "_" + instance . widgetName + "_options" ] ) {
208+ instance . element [ instance . widgetName ] (
209+ that [ "_" + instance . widgetName + "_options" ] (
199210 value ,
200211 that . options . direction === "vertical"
201212 )
0 commit comments