Re: [csswg-drafts] [css-contain-4] Define a range syntax for style container queries (#8376)

> but also `style(10px < 10em)` which we could disallow if we think it doesn't fit here.

I don't think there is any reason to disallow this, as this can be a quite common use. Probably not on its own (although, you _could_ want to check the value of `1em`), but when used with mixed custom properties.

> Note also that you can't compare a `<length>` to a unitless zero in in this approach, e.g. `style(--length > 0)` does not work: it needs to be `style(--length > 0px)`. We could special-case this if we wanted, by considering zero implicitly compatible with other numeric types for comparison purposes.

Hmm, as an author, I would expect the `0 = 0px` to be true, in the same way `1.0` will be equal to `1`, _as long as we know the type_. Like when we have a style query with a registered `<length>` custom property, a `0` and `0px` comparison will be always true: https://codepen.io/kizu/pen/ByaPWQv, so I'd vote for special-casing `0` to be more flexible.

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


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

Received on Tuesday, 25 March 2025 13:57:13 UTC