W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2019

Re: [csswg-drafts] [css-values] Clarify that calc(0) is never a length (#4554)

From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
Date: Fri, 06 Dec 2019 10:36:30 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-562522183-1575628589-sysbot+gh@w3.org>
@SelenIT The thing with calc() is that you don't know whether it's e.g. a valid length until you determine the type of the calculation and get «[ "length" → 1 ]». So more than “would produce a valid value for that property if parsed that way” I think it's “*could* produce a valid value for that property if parsed that way”.

But I agree “parsed as … in the property” is a bit ambiguous. A possible way to clarify this could be:
 - Allow `<zero>` in lengths, as you suggested

    > (i.e. can be syntactically represented as `<zero>`).

 - In [calc() type checking](https://drafts.csswg.org/css-values/#calc-type-checking) make it explicit that only a `<length>` different than `<zero>` can get the «[ "length" → 1 ]» type.

    > - `<length>` different than `<zero>`
    >    the type is «[ "length" → 1 ]»

 - Keep the note about `<number>` taking precedence over `<length>`, to still cover things like `line-height: 0`.

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4554#issuecomment-562522183 using your GitHub account
Received on Friday, 6 December 2019 10:36:31 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:57 UTC