[csswg-drafts] [mediaqueries] Should a top-level not be evaluated as a <media-not> if possible?

grorg has just created a new issue for 
https://github.com/w3c/csswg-drafts:

== [mediaqueries] Should a top-level not be evaluated as a <media-not>
 if possible? ==
Suppose we have:

div {
  width: 100px;
  height: 100px;
  background-color: red;
}

@media not (min-width: 600px) {
  div {
    background-color: blue;
  }
}

Then the @media rule follows

[[[
2.2.1. Negating a Media Query: the not keyword

An individual media query can have its result negated by prefixing it 
with the keyword not. If the media query would normally evaluate to 
true, prefixing it with not makes it evaluate to false, and vice 
versa.
]]]

And it gives an example.

However, I don't this this rule applies in this case. Check out 
Section 3. Syntax.

<media-query> = <media-condition>
             | [ not | only ]? <media-type> [ and 
<media-condition-without-or> ]?

In our example, it matches <media-condition>, rather than "not 
<media-type>".

<media-condition> = <media-not> | <media-and> | <media-or> | 
<media-in-parens>

Cool. It looks like we are a <media-not>.

<media-not> = not <media-in-parens>
<media-in-parens> = ( <media-condition> ) | <media-feature> | 
<general-enclosed>

So this is a media-not, that has a media-in-parens that is a 
media-feature.

However, none of the browsers implement this. I expect because they 
treat the "not" as the prefix to a <media-type>, and then decide that 
the type is invalid.

Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/952 using your GitHub 
account

Received on Wednesday, 18 January 2017 00:30:08 UTC