Re: [csswg-drafts] [css-syntax] numeric separators (#9293)

Right, they're currently parsed as dimension tokens. I think there *is* some use of `_` prefixes in browser-internal units; I seem to recall a `__qem` unit or something to handle a length quirk at some point. But I'm pretty sure they're all something non-digit following the underscore.

So the JS rules are that _ isn't allowed at the beginning or end of the number, and you can't have two in a row - `_1`, `1_`, and `1__0` are all invalid. Matching that in CSS parsing is pretty convenient, then - if we see an underscore, we just check if the next character is a digit or not, and decide whether to keep parsing a number or switch to parsing the unit.

So yeah, this is likely safe?

So, specifically, we'd change steps 2, 4, and 5.3 of <https://drafts.csswg.org/css-syntax/#consume-a-number> to skip past single underscores followed by a digit, as long as we'd already seen at least one digit.

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


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

Received on Friday, 1 September 2023 19:02:25 UTC