@@ -19,40 +19,33 @@ $.widget( "ui.spinner", {
19
19
widgetEventPrefix : "spin" ,
20
20
options : {
21
21
incremental : true ,
22
- max : null ,
23
- min : null ,
22
+ max : Number . MAX_VALUE ,
23
+ min : - Number . MAX_VALUE ,
24
24
numberFormat : null ,
25
25
page : 10 ,
26
- step : null ,
26
+ step : 1 ,
27
27
value : null
28
28
} ,
29
29
30
30
_create : function ( ) {
31
- this . _markupOptions ( ) ;
31
+ this . value ( this . options . value !== null ? this . options . value : this . element . val ( ) || 0 ) ;
32
32
this . _draw ( ) ;
33
33
this . _mousewheel ( ) ;
34
34
this . _aria ( ) ;
35
35
} ,
36
36
37
- // TODO: should we use _getCreateOptions() now?
38
- // would increase overhead of init when options are specified,
39
- // but would move the defaults to the right location
40
- // and use our API the way it's meant to be used
41
- _markupOptions : function ( ) {
42
- var that = this ;
43
- $ . each ( {
44
- min : - Number . MAX_VALUE ,
45
- max : Number . MAX_VALUE ,
46
- step : 1
47
- } , function ( attr , defaultValue ) {
48
- if ( that . options [ attr ] === null ) {
49
- var value = that . element . attr ( attr ) ;
50
- that . options [ attr ] = typeof value === "string" && value . length > 0 ?
51
- that . _parse ( value ) :
52
- defaultValue ;
37
+ _getCreateOptions : function ( ) {
38
+ var options = { } ,
39
+ element = this . element ;
40
+
41
+ $ . each ( [ "min" , "max" , "step" ] , function ( i , option ) {
42
+ var value = element . attr ( option ) ;
43
+ if ( value !== undefined ) {
44
+ options [ option ] = value ;
53
45
}
54
46
} ) ;
55
- this . value ( this . options . value !== null ? this . options . value : this . element . val ( ) || 0 ) ;
47
+
48
+ return options ;
56
49
} ,
57
50
58
51
_draw : function ( ) {
0 commit comments