@@ -33,7 +33,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
33
33
34
34
cType = control [ 0 ] . nodeName . toLowerCase ( ) ,
35
35
36
- selectClass = ( cType == "select" ) ? "ui-slider-switch" : "" ,
36
+ selectClass = ( cType === "select" ) ? "ui-slider-switch" : "" ,
37
37
38
38
controlID = control . attr ( "id" ) ,
39
39
@@ -44,16 +44,16 @@ $.widget( "mobile.slider", $.mobile.widget, {
44
44
label = $label . attr ( "id" , labelID ) ,
45
45
46
46
val = function ( ) {
47
- return cType == "input" ? parseFloat ( control . val ( ) ) : control [ 0 ] . selectedIndex ;
47
+ return cType === "input" ? parseFloat ( control . val ( ) ) : control [ 0 ] . selectedIndex ;
48
48
} ,
49
49
50
- min = cType == "input" ? parseFloat ( control . attr ( "min" ) ) : 0 ,
50
+ min = cType === "input" ? parseFloat ( control . attr ( "min" ) ) : 0 ,
51
51
52
- max = cType == "input" ? parseFloat ( control . attr ( "max" ) ) : control . find ( "option" ) . length - 1 ,
52
+ max = cType === "input" ? parseFloat ( control . attr ( "max" ) ) : control . find ( "option" ) . length - 1 ,
53
53
54
54
step = window . parseFloat ( control . attr ( "step" ) || 1 ) ,
55
55
56
- inlineClass = ( this . options . inline || control . jqmData ( "inline" ) == true ) ? " ui-slider-inline" : "" ,
56
+ inlineClass = ( this . options . inline || control . jqmData ( "inline" ) === true ) ? " ui-slider-inline" : "" ,
57
57
58
58
miniClass = ( this . options . mini || control . jqmData ( "mini" ) ) ? " ui-slider-mini" : "" ,
59
59
@@ -63,7 +63,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
63
63
domSlider = document . createElement ( 'div' ) ,
64
64
slider = $ ( domSlider ) ,
65
65
66
- valuebg = control . jqmData ( "highlight" ) && cType != "select" ? ( function ( ) {
66
+ valuebg = control . jqmData ( "highlight" ) && cType !== "select" ? ( function ( ) {
67
67
var bg = document . createElement ( 'div' ) ;
68
68
bg . className = 'ui-slider-bg ' + $ . mobile . activeBtnClass + ' ui-btn-corner-all' ;
69
69
return $ ( bg ) . prependTo ( slider ) ;
@@ -98,7 +98,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
98
98
mouseMoved : false
99
99
} ) ;
100
100
101
- if ( cType == "select" ) {
101
+ if ( cType === "select" ) {
102
102
var wrapper = document . createElement ( 'div' ) ;
103
103
wrapper . className = 'ui-slider-inneroffset' ;
104
104
@@ -196,7 +196,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
196
196
197
197
// this is a drag, change the value only if user dragged enough
198
198
if ( self . userModified ) {
199
- self . refresh ( self . beforeStart == 0 ? 1 : 0 ) ;
199
+ self . refresh ( self . beforeStart === 0 ? 1 : 0 ) ;
200
200
}
201
201
else {
202
202
self . refresh ( self . beforeStart ) ;
@@ -205,7 +205,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
205
205
}
206
206
else {
207
207
// this is just a click, change the value
208
- self . refresh ( self . beforeStart == 0 ? 1 : 0 ) ;
208
+ self . refresh ( self . beforeStart === 0 ? 1 : 0 ) ;
209
209
}
210
210
211
211
}
@@ -219,7 +219,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
219
219
slider . insertAfter ( control ) ;
220
220
221
221
// Only add focus class to toggle switch, sliders get it automatically from ui-btn
222
- if ( cType == 'select' ) {
222
+ if ( cType === 'select' ) {
223
223
this . handle . bind ( {
224
224
focus : function ( ) {
225
225
slider . addClass ( $ . mobile . focusClass ) ;
@@ -365,7 +365,10 @@ $.widget( "mobile.slider", $.mobile.widget, {
365
365
"aria-valuetext" : cType === "input" ? newval : control . find ( "option" ) . eq ( newval ) . getEncodedText ( ) ,
366
366
title : cType === "input" ? newval : control . find ( "option" ) . eq ( newval ) . getEncodedText ( )
367
367
} ) ;
368
- this . valuebg && this . valuebg . css ( "width" , percent + "%" ) ;
368
+
369
+ if ( this . valuebg ) {
370
+ this . valuebg . css ( "width" , percent + "%" ) ;
371
+ }
369
372
370
373
// drag the label widths
371
374
if ( this . _labels ) {
0 commit comments