Disposition of comments for Media Queries CR

This document is a proposed disposition of comments on the Media Queries CR sent to the www-style mailing list. The Media Queries CR was first published 8 July 2002, with an editorial revision published 6 June 2007.

Disposition of comments at last call.

The following color coding convention is used for comments after the 6 June 2007 publication:

(There were no formal objections.)

Comment from Art Barstow on Tue, 16 Jul 2002; answer on www-style.
1 Given the W3C has already developed a framework (CC/PP) for describing device capabilities (to be used by a server to generate appropriate content), why did the CSS WG ignore this work and develop yet another, competing solution? Media Queries are different in several respects. First, the communication goes the other way and the client (rather than the server) makes the decision on what style sheet to use. The CSS WG thinks there is room for both a client-based and a server-based solution. Second, the work on Media Queries is continued from HTML4 where section 6.13 sketches a solution very close to Media Queries. So, the solution was developed before the work on CC/PP started and should not be interpreted as hostile to CC/PP.

Also, see disposition of comments from Philipp Hoschka in the disposition of comments to the Last Call.

Comment from Susan Lesch on Sat, 8 Feb 2003.

These are minor editorial comments for your Media Queries Candidate Recommendation...

Comment from Arve Bersvendsen 07 Aug 2003.
3The specification does not seem to address exactly how aspect ratios should be queried. The spec seems to assert/dictate that pixel height divided by pixel width provides the correct device aspect ratio. For some devices, one cannot assume that pixel-height/pixel-width provides the correct aspect ratio. Resolved. (See comment 16.)
Comment from Christoph Päper.
4 Regarding CSS 3 Media Queries (CR 2002-07-08), I would like to propose an additional "media feature" to describe whether or what kind of images are supported:
   images (or image)
   Value: none | bitmap | vector | all
   Applies to: visual media types
   Accepts min/max prefixes: no
It is an interesting idea to add queries on what features a UA supports. One could, for example, also add media queries to check whether a UA supports multi-column layout or CSS3 selectors. This may become the topic of a future specification, but the CSS WG do not want to address this big task in a relatively stable draft. Also, it should be pointed out that UAs have a history of falsifying their identity to make sure they receive all content.
Comment from Anne van Kesteren 07 Jul 2005.
5 Where in CSS3 is defined that @page is allowed in @media as in:
@media print{

I couldn't find it anywhere and I guess it should have been defined in CSS 3 media queries which points to CSS 2.1 (or 2.0, actually) which I believe forbids it. However, the CSS 3 paged media module gives some examples of it which make it same like it is allowed. (And it would make sense.)

The expectation is that other modules will define this.
Comment from Anne van Kesteren Sat, 23 Jul 2005.
Comment from Anne van Kesteren Mon, 31 Mar 2008.
6I was wondering why a negative <length> for 'width' (and other media features) is not disallowed ... I hope a further revision of the specification could say that "<length> must be a positive integer when applied to a media feature specified in this specification." (Perhaps adding "or zero" to that for clarity if needed.) With my editor's hat on I went through all the features and clarified what type of "numbers" they could hold and whether those could be negative, zero, or just positive.
Comment from Simon Pieters Fri, 16 Dec 2005.
7 I think that if @media has an empty list of media queries, it should be equivalent to "all". So the following at-rules all have the media query "all":
@media {}
@media all {}
@media "foo" {}
@media all "foo" {}

What should happen when the name is the empty string? I guess it should work the same way as <link rel=stylesheet title=""> in HTML. In Mozilla and Opera, the empty string is equivalent to no name at all (or the other way around, no name is equivalent to the empty string). Thus, I think the following should be equivalent:

@media all {}
@media all "" {}
We agree that a syntax where 'all' is omitted may be handy. The revised CR adds a shorthand syntax for media queries that apply to all media types; the keyword ''all'' can be left out (along with the trailing ''and''). These two media queries are equivalent:
  @media all and (orientation: portrait) { ... }
  @media (orientation: portrait) { ... }
Comment from L. David Baron on Thu, 11 May 2006; answer on www-style.
8 css3-mediaqueries doesn't seem to define the error handling behavior for syntactically incorrect media queries. This needs to be defined so that it is possible to know which of the following rules should make p elements green:
@media all and (min-width: 1px), all and (min-width: more than 1px) {
  p { color: green }

@media all and (min-width: 1px), all and (unknown-feature: 3px) {
  p { color: green }

@media all and (min-width: 1px), all and (min-width: 1unknownunit) {
  p { color: green }

@media all and (min-width: 1px), all and ((< min-width 200px)) {
  p { color: green }

@media all and (min-width: 1px), all and (width at least 200px) {
  p { color: green }

Section 5 does say this:

Since "max-weight" is an unknown media feature, the Media Query is false and the associated style sheet will not be applied.

But it doesn't say how unknown media features are parsed. Is anything unknown within matched parentheses accepted, but considered always false?

This is now clarified in the new error handling section.

Comment from L. David Baron Thu, 11 May 2006.
9Section 4 of http://www.w3.org/TR/2002/CR-css3-mediaqueries-20020708 has the example:
@media screen and (color), projection and (color)
 { @import url(http://www.example.com/color) }
even though @import is not allowed inside @media. (Or is that supposed to be changed in CSS3?)
The example was changed in the editorial revision published 6 June 2007.
10It would also probably be good if some examples in the spec were media lists on @import rules; this is a good candidate. Examples using @import rules were added in the editorial revision published 6 June 2007.
Comment from Christoph Päper on 22 Aug 2006.
11CSS3 Media Queries CR introduces two new units (7.), |dpi| and | dpcm|, solely for its |resolution| media feature (6.9.). Could this be changed or at least be amended to also allow standard CSS absolute length units (e.g. |mm|)? The values using |in| and |cm| would of course be the respective reciprocals of the current ones and described the size of one pointW pixel. If a new unit was needed at all this would be |um|, the ASCII representation of 'µm' for micrometre, approved by ISO (31?). The 'dpi' unit is most commonly used to describe resolution, and 'dpcm' provides a SI-based alternative. Adding even more units to describe resolution seems excessive at this point.
12It might also be a good idea to make this media feature a shorthand for horizontal and vertical resolution for which separate features might be added later. The WG has decided to handle differences in vertical and horizontal resolution as described in comment #3.
Comment from Anne van Kesteren on Mon, 15 Jan 2007.

Parsing media queries

In HTML4 it was pretty clear. You first split on the "," and then remove all characters after the first non ASCII-letter, hyhen or digit. The resulting values are the media specified.

For Media Queries it's not clear what rules you have to follow when the media query given (after splitting on ",") doesn't match the syntax. It's important to know this for the CSSOM MediaList interface for instance.

After reading the reply to comment #8, Anne writes: Ah ok, I guess that sort of solves it. It does mean though that "not all and (foobar)" would apply. Is that desirable? I was thinking that such a media query should perhaps simply be ignored completely so we don't have to worry about how to represent it in the DOM either. That seems also more in line with error handling in CSS.

This is now addressed by the revised syntax section.
Comment from fantasai Mon, 13 Aug 2007.

The poster suggested that it would be more useful to use the media *groups* defined in CSS2.1 [1]. E.g.

   @media paged { ... }
Too late for this version. We should reconsider this for Media Queries Level 4.
Comment from fantasai Tue, 21 Aug 2007.
15 Today we discussed how imprecision in device hardware results in display widths and heights that are not *exactly* in line with the nominal width and height. It was suggested that we should allow some fuzz factor in media query matching for this reason. No change.
Comment from fantasai Tue, 21 Aug 2007.
Proposed changes:


   # In this specification, aspect ratio is defined as the number of
   # horizontal pixels over the number of vertical pixels.

   change to

   | In this specification, aspect ratio is defined as the horizontal
   | length of the device's display divided by its vertical length.


   # The 'resolution' media feature describes the resolution of the
   # output device, i.e. the density of the pixels.


   | When querying devices with non-square pixels, in 'min-resolution'
   | queries the least-dense dimension must be compared to the specified
   | value and in 'max-resolution' queries the most-dense dimensions must
   | be compared instead. A fixed 'resolution' query never matches a device
   | with non-square pixels.

   (Alternatively we could allow two values to query each dimension
   independently, but I don't think this is useful.)
Comment from Stewart Brodie Wed, 22 Aug 2007.
'not' and unknown media types:

Section 3 says: "The presence of the keyword 'not' at the beginning of the
query negates the results."  Section 4 says: "Media queries involving
unknown media types are always false".

When I read that, the word 'always' led me to wonder whether or not unknown
media types trump the section 3 definition of 'not'.  I suggest the
following clarifications:

1) remove the word "always" from the section 4 statement
2) Add an example showing that the following media query is true:

     @media not 3d-glasses { ... }
'not foo' is true and 'foo' is false. (3d-glasses is a parse error.)
Comment from Stewart Brodie Wed, 22 Aug 2007.
18 Does "color-index" have a zero value unless a lookup table is used? If the device does not use a color lookup table, the value is zero.
Comment from Andrew Fedoniouk Tue, 28 Aug 2007.

Is it possible to add in media queries [1] value that will indicate that UA is running with high-contrast-screen settings?

Too late for this version. We should reconsider this for Media Queries Level 4.
Comment from Ian Hickson 6 Nov 2007

it'd be nice if we defined the lack of a media query string to mean "all"

Comment from Henri Sivonen 14 Nov 2007.

Parsing is not well defined in terms of whitespace and error handling.

This is now addressed by the syntax section.
Comment from Henri Sivonen 17 Nov 2007.

If a media feature does not match the media type is that an error?

No. Writing "speech and (width:100px)" is acceptable. The validator may issue a warning though.
Comment from Henri Sivonen 17 Nov 2007.

grid doesn't apply to all media

Fixed, thanks!
Comment from Anne van Kesteren 03 Dec 2007.

I think that the Media Queries draft http://www.w3.org/TR/2007/CR-css3-mediaqueries-20070606/ should either define media types itself or should reference CSS 2.1 for them. Referencing HTML4 and CSS2 for these seems outdated. For instance, "aural" is deprecated in CSS 2.1, but "speech" is not. "speech" is not mentioned in Media Queries and "aural" is used in examples and mentioned several times.

Too late for this version. We should reconsider this for Media Queries Level 4.
Comment from Anne van Kesteren 10 Dec 2007.
25Syntax issues. Addressed. (Syntax is now described in terms of CSS 2.1 eliminating these issues.)
Comment from Anne van Kesteren 12 Dec 2007.
26Using the same syntax rules for HTML and CSS. Addressed by using Bert's syntax proposal.
Comment from Simon Proctor 19 Dec 2007
27 Introducing a 'supports()' querying feature. Too late for this version. We should reconsider this for Media Queries Level 4.
Comment from David Baron 06 Apr 2008
28 What does '(scan)' mean? The draft is clarified to mention that each media feature (including min/max prefixed) "(media-feature)" is equivalent to "(media-feature:x)" for when x is not equal to 0. (If media-feature does not accept 0 x can be any value.)
Comment from David Baron 07 Apr 2008
29 Bad examples for orientation. (Only value was given.) Examples are fixed.
Comment from David Baron 07 Apr 2008
30 Is 'resolution' in terms of CSS or device pixels? Should be device pixels.
Comment from fantasai 24 Apr 2008
31 Definitions of 'height' / 'width' / 'device-height' / 'device-width' need rewording. Reworded as suggested later in the thread.
Comment from Stewart Brodie 6 Jun 2008
32 Does the 'resolution' feature take a float or integer? Defined <resolution> to take an <float> immediately followed by a unit identifier per this e-mail from fantasai.
Comment from fantasai 9 Jun 2008
33 Do we need special wording for display-level transformations, like zooming and N-up printing? We're not going into this level of detail for now.
Comment from David Baron 11 Jun 2008
34 Allow whitespace around '/' for the aspect-ratio and device-aspect-ratio media features. Agreed.
Comment from David Baron 19 Jun 2008
http://dev.w3.org/csswg/css3-mediaqueries/#media1 says:
  # For a media feature feature, (feature) will evaluate to true if
  # (feature:x) will evaluate to true for a value x other than zero.
Does this mean:
  (a) (width) is always true, even if the viewport width is zero,
  because "0px" is a value other than zero, or:
  (b) (width) is false when the viewport width is zero because "0px"
  and "0" are both not "other than zero"?
I'd also note that because specified widths cannot be negative,
(max-width) currently behaves the same as (width), whereas
(min-width) is always true.  Is that really intended?
Zero is clarified to mean 0px, 0, etc. Min/max prefixed media features without values cannot be used.
Comment from David Baron 19 Jun 2008
After reading http://dev.w3.org/csswg/css3-mediaqueries/#grid it's
not clear to me whether the queries "(grid: -1)" or "(grid: 2)"
should be parse errors or should always be false.  It should be
Clarified they are indeed parse errors.
Comment from Dean Jackson 30 Oct 2008
37The request is changing the syntax of aspect-ratio and device-aspect-ratio to floats and orientation to angles. The WG decided to not make a change here. The WG also decided to keep aspect-ratio and device-aspect-ratio and not drop them as suggested in the follow-up thread.
Comment from Jens Meiert 22 Sep 2008
38Editorial. Fixed.
Comment from Sergiu Dumitriu 23 Oct 2008
39Editorial comments. Also a question whether 'ex' should be described for tty since 'em' is defined. The WG decided to remove the definition of 'em' for tty and leave that definition up to the values & units draft.
Comment from Andrey Mikhalev 25 Feb 2009
40The grammar mixes CSS2 grammar and CSS core grammar productions. Fixed by using expr rather than value.
Comment from Anne van Kesteren 8 Dec 2008
41Media queries has the implied suggestion to violate core grammar error handling. Added a note of a clarification per fantasai's suggestion.