- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Wed, 29 Nov 2023 20:59:56 +0000
- To: public-css-archive@w3.org
> We are exploring the possibility of using [Webref](https://github.com/w3c/webref) JSONs for automated validation in JetBrains IDEs. Okay. In general, we do not write the specs with the *intention* of them being machine-consumeable; they're intended to be human-readable, instead. That means that some grammar productions end up with prose definitions even if they *could* be written purely in Value Definition Syntax, because it's clearer for humans and less of an editing hazard. For example, if we were to explicitly define `<dimension-unit>` in the grammar, as `px | em| ...`, then we would have to remember to adjust it every time we added a new unit to CSS. It's very easy to forget to do so, and have the definitions drift from correctness. With its current prose definition, tho, it's always correct. > Although now I wonder why the prose definition of `<dimension-unit>` contains '%' if `<dimension-token>` from css-syntax-3 can't consume '%'. I think it'll be better to define dimension-unit without '%', should it be fixed? No, it's good as-is. The fact that percentages are technically a different kind of token in the parser is an implementation detail; for *authors*, percentages and dimensions are identical. And in the particular use-case here, where the behavior is basically just "parse the attribute as a number, then smack the unit onto it", percentages and units are indeed exactly the same for authors. (We do basically the exact same thing in Typed OM, where [`CSSUnitValue`](https://drafts.css-houdini.org/css-typed-om/#simple-numeric) is used to express all dimensions, percentages, and plain numbers. For the latter two, the `.unit` property is just `"percent"` or `"number"`. Again, this is because the distinction between these three separate token types is irrelevant for authors, so we don't reproduce the distinction in JS.) -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9648#issuecomment-1832692281 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 29 November 2023 20:59:59 UTC