Re: [csswg-drafts] [css-values-5] if() conditions with calc() comparisons (#11104)

> Why do we need the parens at all? What kind of ambiguity exists if we can simply use bare comparisons?

You need parens to work with the `<boolean[]>` syntax - the base grammar of a boolean expression *must* be either parenthesized or functions, in order to match with the `<general-enclosed>` term that catches future-compat.

We could, in theory, let you omit the parens if you were just doing a single comparison on its own. But then you'd need to add them if you did `and`/`or`/`not`. I'm weakly against the consistency break. Every *existing* construct that does comparisons uses parens, like `@media (width < 600px) {...}`

> Also, at first, we should probably expand the syntax of style() to allow for comparison operators in addition to :.

That's something for Containment to define; `if()` just pulls that syntax in. (But yes, we should allow it.)

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


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

Received on Friday, 1 November 2024 20:02:11 UTC