W3C home > Mailing lists > Public > www-style@w3.org > April 2012

[css3-mediaqueries] Malformed media query error handling

From: Vasily Stepanov <vasily.stepanov@gmail.com>
Date: Fri, 27 Apr 2012 12:49:58 +0400
Message-ID: <CAKO+nOfUjZ4bUuR8t+B2-Fc-O66tEMtpC0sT+WaagdCSU7cqcw@mail.gmail.com>
To: www-style@w3.org
On Fri, Apr 27, 2012 at 11:40 AM, Florian Rivoal <florianr@opera.com> wrote:
>
> The CSS Working Group has published CSS Media Queries as a Proposed
> Recommendation:
>
>  http://www.w3.org/TR/2012/PR-css3-mediaqueries-20120426/
>
> Media Queries allows authors to tailor the style that they want to
> apply to a document based on characteristics of the environment the
> document is being rendered in.
>
> Changes since CR are corrections of errors in non normative text and
> clarifications, and are detailed in the Changes section. A Disposition
> of Comments is also available:
>
>  http://www.w3.org/Style/2012/MediaQueriesDisposalOfComments.html
>
> Please, send any comments to this mailing list, <www-style@w3.org>, and
> please, prefix the subject line with
>
>  [css3-mediaqueries]
>
> (as I did on this message).
>
>
> For the CSS WG,
> Florian Rivoal
>

Hi all,


According to error handling, described in section 3.1:
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.
There is an example for this case:
@media (example, all,), speech { /* only applicable to speech devices */ }

CSS21 says the following in section 4.1.5: An at-rule consists of
everything up to and including the next semicolon (;) or the next
block, whichever comes first.

Consider this malformed CSS example:
@media {example, all,}, speech { /* only applicable to speech devices */ }

() block from the previous example has been replaced with {} block.

So it is unclear how should I parse this malformed CSS.

According to CSS21 I have to parse it like this:
@media { /* error while parsing rulesets */ }
/* error while parsing selectors */

According to css3-mediaqueries I have to parse it like this:
@media /* error while parsing media query */ speech { /* ... */ }


Cheers,
Vasily
Received on Friday, 27 April 2012 08:50:27 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:52 GMT