- From: fantasai <fantasai.lists@inkedblade.net>
- Date: Mon, 02 Aug 2010 18:49:18 -0700
- To: Johannes Koch <koch@w3development.de>
- CC: www-style@w3.org
On 07/29/2010 07:05 AM, Johannes Koch wrote: > Hi, > > in <http://www.w3.org/TR/2009/CR-css3-mediaqueries-20090915/#error-handling> we read: > > Malformed media query. User agents are to handle unexpected tokens > encountered while parsing a media query by reading until the end of > the media query, while observing the rules for matching pairs of (), > [], {}, "", and '', and correctly handling escapes. Media queries with > unexpected tokens are ignored. [CSS21] > > @media (example, all,), speech { /* only applicable to speech devices > */ } > @media &test, screen { /* only applicable to screen devices > */ } > > And a little further down: > > Media queries are expected to follow the error handling rules of the > host language as well. > > > In <http://www.w3.org/TR/2009/CR-CSS2-20090908/syndata.html#parsing-errors> we read: > > Malformed statements. User agents must handle unexpected tokens > encountered while parsing a statement by reading until the end of the > statement, while observing the rules for matching pairs of (), [], {}, > "", and '', and correctly handling escapes. > > and in <http://www.w3.org/TR/2009/CR-CSS2-20090908/media.html#at-media-rule>: > > Invalid statements must be ignored per 4.1.7 "Rule sets, declaration > blocks, and selectors" and 4.2 "Rules for handling parsing errors." > > > Is a CSS 2.1 user agent required to ignore both @media rules quoted above > "by reading until the end of the statement", while a CSS Media Queries user > agent will only read "until the end of the media query" (ignoring "(example, all,)," > and "&test,") and apply the set of statements to "speech" (1st @media rule) and > "screen" (2nd @media rule)? The statement from 7.2.1 that you're missing here is # @media and @import rules with unknown media types are treated as if # the unknown media types are not present. An invalid media query from CSS2.1's perspective is effectively an unknown media type. I'm not sure what the purpose of the "Media queries are expected to follow" sentence from Media Queries. I agree that CSS2.1 could be more clear on how to handle unexpected tokens in the media list. Probably s/unknown/unknown or malformed/ or s/unknown/invalid/ in the above-quoted statement, and somehow adding the brackets-and-quotes-matching rules to the general definition of "ignore" would help... ~fantasai
Received on Tuesday, 3 August 2010 01:49:55 UTC