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

Tip on how to fix that caveat #10

Open
dead-claudia opened this issue Apr 15, 2017 · 4 comments
Open

Tip on how to fix that caveat #10

dead-claudia opened this issue Apr 15, 2017 · 4 comments

Comments

@dead-claudia
Copy link

That caveat you listed, you can work around it by sanitizing the output using parseFloat(size).toString() + "px".

@aleclarson
Copy link

The caveat says "very big lists", which means the problem is large integers and not floats.

@dead-claudia
Copy link
Author

@aleclarson I'm aware. JS has no such thing as actual integers (only doubles per spec, with a few conversions to an integer-like float), and so floats would perfectly suffice here. If you only care about integers, you have two options:

  • Use Math.floor(parseFloat(size)) or Math.trunc(parseFloat(size)) (which tolerates decimal input)
  • Use parseInt(size) (which doesn't tolerate decimal input)

Note that large integers and non-integer floats could cause similar issues, so you realistically need to address both.

@aleclarson
Copy link

@isiahmeadows True 😅

@jwhitley
Copy link

FYI the caveat issue, FF Bug 373875, was closed as fixed about a year ago now.

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

3 participants