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

[css-syntax-3] Do not always parse a numeric expressed with scientific notation to a number #7289

Closed
cdoublev opened this issue May 20, 2022 · 4 comments

Comments

@cdoublev
Copy link
Collaborator

cdoublev commented May 20, 2022

I do not believe there are meaningfull cases that warrant a fix for the following, if it is an actual bug. My motivation for creating this issue is also to use it for code documentation. I have searched for existing issues with "scientific notation integer", with no success. I also searched for a WPT.

order: 1e0 is parsed as invalid in browsers because order should be an <integer>.

I do not have a high education in maths: perhaps a number representing an integer but expressed with the scientific notation must not be considered as an integer.

Otherwise, step 5.3 of consume a number could be replaced after step 6 by evaluating if repr is an integer. I do not know how this evaluation can be translated into spec/WebIDL terms.

Perhaps it can not be fixed because it would break parsing eg. <signless-integer> and <signed-integer>.

Or it may simply be decided that it is not worth to be fixed.

@dbaron
Copy link
Member

dbaron commented May 20, 2022

5.2. Integers: the <integer> type and 5.3. Real Numbers: the <number> type in css-values are reasonably clear (when read together, at least) that scientific notation is allowed for <number> but not for <integer>.

@cdoublev
Copy link
Collaborator Author

Oh, that is right, thanks. Even just 5.3 is enough for me:

When written literally, a number is either an integer, or zero or more decimal digits followed by a dot (.) followed by one or more decimal digits and optionally an exponent composed of "e" or "E" and an integer.

As noted, I can not say if it is mathematically correct but it is defined that numbers using the scientific notation are not integers in CSS.

Do you think mathematical correctness does not matter and I can close this issue?

@Loirooriol
Copy link
Contributor

See #6471 (comment)

@tabatkins
Copy link
Member

Yeah, closing this as essentially a dupe of #6471. I'm still open to amending Syntax to let <integer>e0 return an integer token, but we can continue that discussion over there; likely we just need to do some instrumentation to figure out the chance for breakage.

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

4 participants