- From: CSS Meeting Bot via GitHub <noreply@w3.org>
- Date: Wed, 20 Aug 2025 08:32:01 +0000
- To: public-css-archive@w3.org
The CSS Working Group just discussed `[css-conditional-6] Behavior of style(0 = 0px)`, and agreed to the following: * `RESOLVED: 0 and 0px are quivalent for conditions` <details><summary>The full IRC log of that discussion</summary> <fantasai> andruud: Parser has behavior for <length> that you can supply 0 without unit<br> <fantasai> andruud: question came up during range queries, whether we should keep that behavior for comparison<br> <fantasai> andruud: e.g. is 0 = 0px for style queries?<br> <fantasai> andruud: zero is a number, 0px is a length, so not equal<br> <miriam> q+<br> <fantasai> andruud: in terms of consensus, it seems to be everyone against tab ;)<br> <emilio> q+<br> <kizu> q+<br> <astearns> ack miriam<br> <noamr> q+<br> <astearns> ack emilio<br> <oriol> q+<br> <fantasai> miriam: I don't have a strong opinion either, just unhappy that neither option is consistent across the board<br> <fantasai> emilio: I will side with Tab on this one<br> <fantasai> emilio: style queries are generally untyped<br> <lea> q?<br> <lea> q<br> <fantasai> emilio: and you have the same issue with calc(), don't know if zero is degrees length etc.<br> <lea> q+<br> <fantasai> TabAtkins: unitless zeros in calc() screw up figuring out the type of the calc()<br> <fantasai> TabAtkins: that doesn't apply here, just comparing two things<br> <fantasai> TabAtkins: We could go either way<br> <fantasai> emilio: for something like width > 0, you know width is a length<br> <fantasai> andruud: yeah, we'd need to do different special casing<br> <TabAtkins> like, is `calc(0 / 10px)`, is that unit 1/length, or just <number>?<br> <fantasai> TabAtkins: but you can use width > 0 in MQ<br> <fantasai> emilio: you know you're parsing a length at that point<br> <fantasai> TabAtkins: yes but because they're zeros...<br> <fantasai> emilio: implementable, not a big issue<br> <astearns> ack kizu<br> <fantasai> kizu: I think I want them ...<br> <fantasai> kizu: if you define custom registered property [missed]<br> <fantasai> kizu: for type, getting type of a custom property and you want to understand later on, you explicitly say "I'm checking the type on this"<br> <fantasai> kizu: but authors will expect 0 to 0px, so consistent for if() etc. to work this way<br> <astearns> ack noamr<br> <fantasai> noamr: aren't style queries also typed?<br> <kizu> https://codepen.io/kizu/pen/azvYVJw<br> <fantasai> noamr: can't we do something where if both values when parsed ...<br> <fantasai> TabAtkins: no, we don't necessarily know<br> <fantasai> noamr: they're all matching a property<br> <fantasai> TabAtkins: not necessarily, e.g. inside an 'if'<br> <astearns> ack oriol<br> <fantasai> oriol: I'm slightly more with Tab here<br> <fantasai> oriol: I could go either way for lenghts, but other dimensions that can accept unitless zeros so weird to accept<br> <astearns> ack lea<br> <fantasai> oriol: even for lenghts, lean more towards Tab, but it's a weak opinion<br> <fantasai> lea: My expectation is to compare the unitless zero to the other side<br> <fantasai> lea: if they're valid, then they should match<br> <fantasai> lea: e.g. zero for angles is not generally valid<br> <fantasai> lea: so would expect not to match in that case<br> <fantasai> lea: Where did we resolve to use style() for these comparisons<br> <astearns> ack fantasai<br> <astearns> fantasai: what lea said<br> <lea> q+<br> <fantasai> noamr: I think it would be sensible to start by shipping something more rigid, and then add type-based equivalence later, maybe more than just unitless zero<br> <lea> q-<br> <fantasai> astearns: that would be type coercion<br> <lea> q+<br> <lea> q- (sorry)<br> <fantasai> noamr: start with that and then do === later<br> <fantasai> noamr: more use cases than just unitless zero<br> <astearns> s/be type/be explicit type/<br> <astearns> ack lea<br> <fantasai> lea: My concern is case where you have a custom property (token stream) and then you register as a length, and now it stops matching<br> <fantasai> lea: would be better if consistent with how lengths generally work<br> <astearns> ack fantasai<br> <astearns> fantasai: from a user perspective we’re used to 0 = 0px<br> <lea> +1<br> <TabAtkins> I would be okay with a literal 0 allowing matching against a 0 <number> *or* a 0 <length><br> <TabAtkins> but a calculated 0 shouldn't be, maybe?<br> <ydaniv> +1 to fantasai<br> <miriam> +1 (but that inconsistency is already confusing people in calc)<br> <TabAtkins> 1. calc()-consistency, 0 != 0px<br> <TabAtkins> 2. property-consistency, 0 == 0px (but no other unit)<br> <fantasai> TabAtkins: it is the case that calc(0) is invalid in [missed], so it would have to be a literal zero<br> <TabAtkins> s/missed/width prop/<br> <fantasai> astearns: Proposed resolution that literal zero does equal a 0 length for conditions<br> <fantasai> astearns: Anyone want to argue against?<br> <fantasai> astearns: Anyone want to object?<br> <fantasai> RESOLVED: 0 and 0px are quivalent for conditions<br> <TabAtkins> (making clear, i mistyped above; "no other type", not "no other unit". 0 == 0rem, too)<br> </details> -- GitHub Notification of comment by css-meeting-bot Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12236#issuecomment-3204826253 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 20 August 2025 08:32:02 UTC