Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allowNull: true with no min or max results in Infinity/-Infinity #13

Open
mrmcderm opened this issue Sep 7, 2011 · 0 comments
Open

Comments

@mrmcderm
Copy link

mrmcderm commented Sep 7, 2011

I noticed some interesting behavior and I was not sure if it was intended/by design or if it was a defect.

If I created a spinner that allowed nulls, had a step value, but did not have a min or a max:

$('#mySpinner').spinner( { increment: 'fast', allowNull: true, step: 0.001 });

then every time I tried to spin, the textbox was populated with either 'Infinity' or '-Infinity' depending on whether I tried to spin up or down.

I noticed that in the _doSpin function, if value == null and the step is greater than 0, then value is set to min or max, but if those aren't set, they return the string '-Infinity' or 'Infinity' respectively.

I added a check after that where if value is '-Infinity' or 'Infinity' then set value to 0.

The resulting behavior is that if I have an empty (null) spinner that has a step value, and I attempt to spin in either direction, it succesfully beings to spin from 0.

So far I haven't seen any issues with this change, but I'm not sure if this is the right way to address the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant