Re: [csswg-drafts] [css-values-5] attr()'s "px"/etc keywords (#11034)

Anything of that sort is possible, sure, but we should assume that anything we allow in this production might eventually show up in a CSS spec, or possibly collide with something in a CSS spec. Having an unbounded set of `<px>`, `<cqw>`, etc productions doesn't sound very safe in that regard, but a special syntax on the production itself (akin to the range restriction syntax) does.

And, personally, I think it communicates better. If I saw `attr(foo <px>)`, I'd probably assume it was expecting a value like `5px` (and would reject `5em`). But `attr(foo <number px>)` is clearer that you're looking for a number, and involving `px` in some way; you *might* think of a value like `5px`, but then you have to ask why it's not spelled `<length>` or even `<length px>` if we were being specific about the unit; the intended meaning (accept `5` like `<number>` would, but give it the `px` unit) is conceptually nearby and easy to hit by guessing.

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


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

Received on Tuesday, 15 October 2024 18:19:31 UTC