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