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
[css-syntax] Should numbers have type integer
whenever the actual value is an integer?
#10238
Comments
Anything with a decimal point should not be parsed as |
Agreed on that point. The only real point of contention, I think, is whether sci-not can produce integers - both |
How does producing an integer from scientific notation differ from producing it from decimal notation? It seems that both depend on evaluating the mathematical value of the input number. I have no math/cs degree so please forgive me if the answer is obvious. Could it be useful to produce |
IMO if |
https://drafts.csswg.org/cssom/#serializing-css-values Could say that anything that serializes into an integer is actually an integer. |
Note that spec needs edits: #8538 (comment) |
Ah right, we are still missing that edit, partially because of this issue (and partially because I forgot about it). Okay, proposal: A number is an integer if it either:
The serialization edit from #8538 will satisfy this; since we serialize to no more than 6 digits after the decimal point, and scinot doesn't kick in for large number until it's substantially larger than a million, any large-number scinot will necessarily be parsed as an integer. |
See : https://drafts.csswg.org/css-syntax/#consume-number
Also mentioned in passing by @tabatkins here : #6471 (comment)
As a result of the current tokenizing rules these values have type
number
:10e3
1000.0
While both arguably represent integer values.
Should the algorithm be updated to reflect this?
You can see the difference between numbers with type
number
andinteger
in action here : https://codepen.io/romainmenke/pen/GRLwLQyWrapping values of type
number
in a math expression already "normalizes" these into integers when possible. (e.g.z-index: calc(10e3)
works)The text was updated successfully, but these errors were encountered: