W3C home > Mailing lists > Public > www-style@w3.org > August 2001

Re: At-rules (@-rules) in @media blocks

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Sat, 11 Aug 2001 23:28:42 +0200
To: "Tantek Celik" <tantek@cs.stanford.edu>
Cc: Boris Zbarsky <bzbarsky@MIT.EDU>, "www-style@w3.org" <www-style@w3.org>
Message-ID: <dq8bnt4tmkqmafg81froovm7gjo615bppe@4ax.com>
* Tantek Celik wrote:
>> So I don't see where forbidding @page in @media makes CSS easier to
>> implement
>In CSS2, there is no nesting of @-rules at all.  This greatly simplifies
>@-rule parsing code.  Parsing something of 1-depth is much easier to code
>(read less code, less chance for buggy code etc.) than parsing something of


  @media screen
    @rule1 { @rule2 "}" { @rule3 { content: "}" } } }
    h1 { color: green }

How do you parse that accoding to the forward-compatibility rules
without parsing the nested at-rules? In order to ignore some token,
you _must_ parse it to know where it ends and according to the generic
syntax you _must_ parse nested at-rules.

I agree that it is simpler to parse one-level nesting than to parse
abitrary levels of nesting but CSS Level 2 doesn't offer this option,
you _must_ parse it. CSS Level 2 even offers more evil possible

  elem { newval: @foo ";}" @bar "{" @baz "@x" { @polar { uri('#') } } }

I fear to test what current parsers do with this ruleset.

I would agree with you, if CSS Level 2 forbid to nest at-rules in the
generic grammar, than you wouldn't have to cope with them, but CSS2
didn't so parsers have to deal with it in order to be forward-compatible
and therefore CSS2 compliant.

>If you could nest 15 levels of @-rules, style sheets would begin looking
>like C++ files, and I don't think you want that.

You won't tell me, that having 15 different style sheets and a base
style sheet with 15 @import rules in order to import all those style
sheets is much simpler and I doubt there are cases where it is
desireable to habe 15 levels of nesting in CSS.

Björn Höhrmann { mailto:bjoern@hoehrmann.de } http://www.bjoernsworld.de
am Badedeich 7 } Telefon: +49(0)4667/981028 { http://bjoern.hoehrmann.de
25899 Dagebüll { PGP Pub. KeyID: 0xA4357E78 } http://www.learn.to/quote/
Received on Saturday, 11 August 2001 17:29:53 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:58 UTC