mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
slider: limit the returned floats to 5 digits after the decimal point, corrects JS float errors (fixes #4124 - Value should always be constrained to valid step values)
This commit is contained in:
parent
9c4b8a9141
commit
2ffcf02de3
@ -287,7 +287,9 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
|
|||||||
if (valueMouseModStep > (this.options.step / 2))
|
if (valueMouseModStep > (this.options.step / 2))
|
||||||
normValue += this.options.step;
|
normValue += this.options.step;
|
||||||
|
|
||||||
return normValue;
|
// Since JavaScript has problems with large floats, round
|
||||||
|
// the final value to 5 digits after the decimal point (see #4124)
|
||||||
|
return parseFloat(normValue.toFixed(5));
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user