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

It's actually fine to use the whole grammar here, now that attr() is an arbitrary-substitution function (aka var()-like). We don't need to know its type at parse time, so it's perfectly fine to write `attr(foo <length> | <number>)`. This would be useful, for example, to pass a value to 'opacity', using `<number> | <percentage>` (which can't be done in the current spec).

And the spec already allows `ident` (spelled `<ident>` in the new syntax), to allow *any* identifier, so allowing *only specific* identifiers via literal idents seems just fine.

So I think we either need to drop the "specific unit" functionality, as suggested, or make the syntax part more distinguishable from other syntax. Or, I guess, add some branches to the `<syntax>` production to allow "number interpreted as unit" natively, like `<number px>` or something.

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


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

Received on Monday, 14 October 2024 22:37:56 UTC