W3C home > Mailing lists > Public > public-css-archive@w3.org > May 2017

Re: [csswg-drafts] [mediaqueries] Non-positive value should be invalid for 'resolution' feature

From: Florian Rivoal via GitHub <sysbot+gh@w3.org>
Date: Fri, 26 May 2017 06:24:51 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-304202588-1495779889-sysbot+gh@w3.org>
On the other side of the discussion, I wonder whether we should actually let negative values parse. `(resolution < -3dpi)` should always be `false`. But if we made it not parse, it would be `unknown` instead of being `false`, as per [the error handling section](https://drafts.csswg.org/mediaqueries-4/#error-handling):

> An unknown <mf-name> or <mf-value>, or disallowed <mf-value>, results in the value “unknown”.

Either way
@media (resolution: -1dpi) { body { background: red; } }
would fail to give a red background on any device, but
@media not (resolution: -1dpi) { body { background: green; } }
could very reasonably give you a green body on all visual devices.  And while we're at it, so could
@media (resolution > -2dpi ) { body { background: green; } }

I don't think there's much of a use case for specifying such nonesense resolutions manually, but they could fall out of calc() or some server side math, and still be usable in range contexts.

If we clarify that this works, we should apply the same logic to other range properties with nonsensical negative values, like `width`

GitHub Notification of comment by frivoal
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1454#issuecomment-304202588 using your GitHub account
Received on Friday, 26 May 2017 06:24:57 UTC

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