W3C home > Mailing lists > Public > www-style@w3.org > June 2008

Re: [CSS2.1] Grammar for @media versus general block parsing

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Wed, 25 Jun 2008 09:38:54 +0200
To: Justin Rogers <justrog@microsoft.com>
Cc: "www-style@w3.org" <www-style@w3.org>
Message-ID: <ieq364hr52t10bf00c4f6krdedv1i96tsu@hive.bjoern.hoehrmann.de>

* Justin Rogers wrote:
>Supporting such a feature in CSS 3 won't be a problem. The consideration
>here is how a CSS 2.1 standards compliant parsing engine should treat the
>rule given the current wording of the specification.

If the latest draft does not say, then you are conforming either way.
The idea behind the forward compatibility parsing requirements however
is that style sheets using new features should parse in old clients as
if the style sheet isn't using the new features. This would only be so
if semicolon-delimited at-rules are never allowed as child of @media,
and implementations treat them as part of an invalid selector even if
they support at-rules with a block as child of @media.

If this is clarified in CSS 2.1, in order to avoid that authors have
to include dummy rules in their future style sheets for compatibility
with downlevel clients, it is likely to specify that you parse for at-
rules of either kind. If this is updated, the example in 4.1.5 may be-
nefit from giving the style sheet with the @import rule removed.

I note that most if not all at-rules have similar problems, e.g., @page
accepts nested at-rules in CSS Level 3, but CSS 2.1 suggests to parse
them like the interior of a ruleset, so you get different behavior for

  @page { @other { }  margin: 1em } /* versus */
  @page { @other { }; margin: 1em } /* versus */

Unless the semi-colon is required (the grammar in css3-page suggests
it is, but the sub-sequent examples do not specify the semi-colon be-
tween at-rules nested inside @page rules), since you would skip to the
following ';' at the same {[(-nesting level when parsing a ruleset, ala

  p { color: red; @generic-syntax-forbids-this { }; color: green }

(You'd wonder then how to handle @page{@other;;margin:1em) ...).
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Wednesday, 25 June 2008 07:39:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:07 GMT