diff options
author | Paul Bakaus <paul.bakaus@googlemail.com> | 2009-02-17 13:01:19 +0000 |
---|---|---|
committer | Paul Bakaus <paul.bakaus@googlemail.com> | 2009-02-17 13:01:19 +0000 |
commit | 2ffcf02de361262e9496719016619c520745e90d (patch) | |
tree | 16e9c9b86de03ff98cdcf243e3bd4a76adbaa847 /ui | |
parent | 9c4b8a9141db4718126f7d383267b22f4eb5df71 (diff) | |
download | jquery-ui-2ffcf02de361262e9496719016619c520745e90d.tar.gz jquery-ui-2ffcf02de361262e9496719016619c520745e90d.zip |
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)
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ui.slider.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ui/ui.slider.js b/ui/ui.slider.js index 91f257157..2b388c6d5 100644 --- a/ui/ui.slider.js +++ b/ui/ui.slider.js @@ -287,7 +287,9 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, { if (valueMouseModStep > (this.options.step / 2)) 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)); }, |