Skip to content

Commit 88f7feb

Browse files
committed
#15262: Round calculated max before compare with max from options.
1 parent 91b6fc3 commit 88f7feb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ui/widgets/slider.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,12 +550,15 @@ return $.widget( "ui.slider", $.ui.mouse, {
550550
step = this.options.step,
551551
aboveMin = Math.round( ( max - min ) / step ) * step;
552552
max = aboveMin + min;
553-
if ( max > this.options.max ) {
553+
// Round the max before compare with max from options.
554+
max = max.toFixed( this._precision() );
555+
var option_max = this.options.max.toFixed( this._precision() );
556+
if ( max > option_max ) {
554557

555558
//If max is not divisible by step, rounding off may increase its value
556559
max -= step;
557560
}
558-
this.max = parseFloat( max.toFixed( this._precision() ) );
561+
this.max = parseFloat(max);
559562
},
560563

561564
_precision: function() {

0 commit comments

Comments
 (0)