W3C home > Mailing lists > Public > public-css-archive@w3.org > February 2018

Re: [csswg-drafts] [mediaqueries] How do media queries with calc() where it can be resolved early serialize?

From: L. David Baron via GitHub <sysbot+gh@w3.org>
Date: Tue, 06 Feb 2018 23:59:36 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-363607954-1517961575-sysbot+gh@w3.org>
It seems like dropping `calc()` lead to a risk of producing something that's syntactically invalid.  For example, the `aspect-ratio` media feature requires positive integers, but range restrictions generally change from parse-time to compute-time inside of `calc()` (although is this still true for `calc()` in media queries?).

This means, I think (but maybe I'm wrong??), that:

```css
@media (aspect-ratio: calc(-1) / calc(-1)) { ... }
```

is syntactically valid, but if it were serialized as:

```css
@media (aspect-ratio: -1 / -1) { ... }
```

then that would be an invalid media feature value, which when reparsed and serialized again would produce:

```css
@media not all { ... }
```

This breaks two of the fundamental principles of serialization (always serialize to valid syntax, serialize to something that when reparsed will serialize to the same thing).

-- 
GitHub Notification of comment by dbaron
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1968#issuecomment-363607954 using your GitHub account
Received on Wednesday, 7 February 2018 00:00:55 UTC

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