bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

CSS media queries should support parens better

NEW
Unassigned

Status

()

Core
CSS Parsing and Computation
7 years ago
7 years ago

People

(Reporter: Jeremy Morton, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
In 2 places in my CSS, I've now come across an example of where it would be nice for the CSS parsing system to support parentheses better.  The first example is this:
@media not all and ((-moz-windows-classic), (-moz-windows-default-theme), (-moz-windows-theme: aero)) { ... }

So I want the query to match if it's NOT the case that one of the '-moz-windows' features match.  The second parens around those three comma-delimited features is not supported by CSS media queries right now.

The second example is:
@media all and (not -moz-windows-theme: aero) and (-moz-windows-default-theme) { ... }

This is saying that I want the query to match if the windows theme ISN'T Aero, but it IS the windows default theme.  because 'not' can't be placed inside parens and has to be at the beginning, this doesn't work either, but it would be nice if it did.

By the way, these could all be rewritten to work using the current media query syntax right now if only it supported nested media queries.  So, if that's an easier implementation, an alternative would be just to enable nested media queries.

eg. One could write the second example like:
@media not all and (-moz-windows-theme: aero) {
  @media all and (-moz-windows-default-theme) {
    ...
  }
}
You need to log in before you can comment on or make changes to this bug.