This repository was archived by the owner on Mar 5, 2025. It is now read-only.
File tree 3 files changed +5
-13
lines changed
3 files changed +5
-13
lines changed Original file line number Diff line number Diff line change 279
279
Plugin . prototype . init = function ( ) {
280
280
this . update ( true , false ) ;
281
281
282
- // Set initial value just in case it is not set already.
283
- // Prevents trouble if we call `update(true)`
284
- this . $element [ 0 ] . value = this . value ;
285
-
286
282
if ( this . onInit && typeof this . onInit === 'function' ) {
287
283
this . onInit ( ) ;
288
284
}
294
290
if ( updateAttributes ) {
295
291
this . min = tryParseFloat ( this . $element [ 0 ] . getAttribute ( 'min' ) , 0 ) ;
296
292
this . max = tryParseFloat ( this . $element [ 0 ] . getAttribute ( 'max' ) , 100 ) ;
297
- this . value = tryParseFloat ( this . $element [ 0 ] . value , this . min + ( this . max - this . min ) / 2 ) ;
293
+ this . value = tryParseFloat ( this . $element [ 0 ] . value , Math . round ( this . min + ( this . max - this . min ) / 2 ) ) ;
298
294
this . step = tryParseFloat ( this . $element [ 0 ] . getAttribute ( 'step' ) , 1 ) ;
299
295
}
300
296
433
429
} ;
434
430
435
431
Plugin . prototype . setValue = function ( value ) {
436
- if ( value === this . value ) {
432
+ if ( value === this . value && this . $element [ 0 ] . value !== '' ) {
437
433
return ;
438
434
}
439
435
Original file line number Diff line number Diff line change 278
278
Plugin . prototype . init = function ( ) {
279
279
this . update ( true , false ) ;
280
280
281
- // Set initial value just in case it is not set already.
282
- // Prevents trouble if we call `update(true)`
283
- this . $element [ 0 ] . value = this . value ;
284
-
285
281
if ( this . onInit && typeof this . onInit === 'function' ) {
286
282
this . onInit ( ) ;
287
283
}
293
289
if ( updateAttributes ) {
294
290
this . min = tryParseFloat ( this . $element [ 0 ] . getAttribute ( 'min' ) , 0 ) ;
295
291
this . max = tryParseFloat ( this . $element [ 0 ] . getAttribute ( 'max' ) , 100 ) ;
296
- this . value = tryParseFloat ( this . $element [ 0 ] . value , this . min + ( this . max - this . min ) / 2 ) ;
292
+ this . value = tryParseFloat ( this . $element [ 0 ] . value , Math . round ( this . min + ( this . max - this . min ) / 2 ) ) ;
297
293
this . step = tryParseFloat ( this . $element [ 0 ] . getAttribute ( 'step' ) , 1 ) ;
298
294
}
299
295
432
428
} ;
433
429
434
430
Plugin . prototype . setValue = function ( value ) {
435
- if ( value === this . value ) {
431
+ if ( value === this . value && this . $element [ 0 ] . value !== '' ) {
436
432
return ;
437
433
}
438
434
You can’t perform that action at this time.
0 commit comments