Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Propose for #3029 empty value not refreshing slider #3033

wants to merge 1 commit into


None yet
3 participants

MauriceG commented Nov 12, 2011

Fix for #3029: checking for empty slider-value


MauriceG commented on 5476182 Nov 14, 2011

because parseFloat( null ) returns NaN


eddiemonge commented Nov 19, 2011

that could leave percentage as a negative number then. That might still be an issue anyway though.


MauriceG commented Nov 21, 2011

@eddiemonge Are you sure? A negative percentage value will be set to 0 a few lines later.


eddiemonge commented Nov 21, 2011

Oops, yeah you are right. seems good then


MauriceG commented Nov 21, 2011

@eddiemonge Danke schön means: thanks a lot.
I've tested it with various values for min/max. No issues.
btw: since when there is a step attribute for range sliders? Did I miss something?


johnbender commented Dec 5, 2011


From the example in the bug, $("#myslider").val('').slider('refresh'); , it appears that your check is sort of disjoint from the check against null above. That is, if the null check above went away, the check would only be looking to see if the val param was undefined. I've committed the following change from

if ( val == null ) {
    val = cType === "input" ? parseFloat( control.val() ) : control[0].selectedIndex;


if ( val == null ) {
    // note the addition of || 0
    val = cType === "input" ? parseFloat( control.val() || 0 ) : control[0].selectedIndex;

with tests here

@johnbender johnbender closed this Dec 5, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment