Re: [csswg-drafts] [css-syntax] Should numbers have type `integer` whenever the actual value is an integer? (#10238)

> I might suggest dropping that last rule, I think it simplifies both the parsing rules and the mental model (No decimal points, no scinot that generates decimal points).

Without that last point, you can't re-use numeric serialization code between JS and CSS (and other contexts). It's not uncommon to get large integers serialized with a decimal component and a large enough exponent to ensure it's a decimal.

> IMO a better solution would be to allow a `<number>` to be used anywhere an `<integer>` is expected, and just be converted to an `<integer>` using some default rounding strategy 

That would be a compat-risky change, as it would mean the properties and values that currently take integers, but might be written with a non-integer and currently ignored for invalidity, would become valid suddenly.

But also, it's separate from this change - *regardless* of whether we allow numbers where integers are expected, we can still define more things to be integers.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10238#issuecomment-2140856540 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 30 May 2024 21:00:21 UTC