File tree Expand file tree Collapse file tree 2 files changed +17
-19
lines changed Expand file tree Collapse file tree 2 files changed +17
-19
lines changed Original file line number Diff line number Diff line change 5
5
var spinner_defaults = {
6
6
disabled : false ,
7
7
incremental : true ,
8
- max : Number . MAX_VALUE ,
9
- min : - Number . MAX_VALUE ,
8
+ max : null ,
9
+ min : null ,
10
10
numberformat : null ,
11
- step : 1 ,
11
+ step : null ,
12
12
value : null
13
13
} ;
14
14
Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ var pageModifier = 10;
19
19
$ . widget ( 'ui.spinner' , {
20
20
options : {
21
21
incremental : true ,
22
- max : Number . MAX_VALUE ,
23
- min : - Number . MAX_VALUE ,
22
+ max : null ,
23
+ min : null ,
24
24
numberformat : null ,
25
- step : 1 ,
25
+ step : null ,
26
26
value : null
27
27
} ,
28
28
@@ -34,19 +34,17 @@ $.widget('ui.spinner', {
34
34
} ,
35
35
36
36
_markupOptions : function ( ) {
37
- // TODO refactor and read only when the related option is null (set default to null, init Number.MAX_VALUE only when nothing is specified)
38
- var min = this . element . attr ( "min" ) ;
39
- if ( typeof min == "string" && min . length > 0 ) {
40
- this . options . min = this . _parse ( min ) ;
41
- }
42
- var max = this . element . attr ( "max" ) ;
43
- if ( typeof max == "string" && max . length > 0 ) {
44
- this . options . max = this . _parse ( max ) ;
45
- }
46
- var step = this . element . attr ( "step" ) ;
47
- if ( typeof step == "string" && step . length > 0 ) {
48
- this . options . step = this . _parse ( step ) ;
49
- }
37
+ var _this = this ;
38
+ $ . each ( {
39
+ min : - Number . MAX_VALUE ,
40
+ max : Number . MAX_VALUE ,
41
+ step : 1
42
+ } , function ( attr , defaultValue ) {
43
+ if ( _this . options [ attr ] === null ) {
44
+ var value = _this . element . attr ( attr ) ;
45
+ _this . options [ attr ] = typeof value == "string" && value . length > 0 ? _this . _parse ( value ) : defaultValue ;
46
+ }
47
+ } ) ;
50
48
this . value ( this . options . value !== null ? this . options . value : this . element . val ( ) || 0 ) ;
51
49
} ,
52
50
You can’t perform that action at this time.
0 commit comments