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

On Saturday 11 August 2001 18:41, Tantek Celik wrote:
> From: Bjoern Hoehrmann <derhoermi@gmx.net>
> > They are allowed by the generic syntax in section 4.1.1 of CSS Level 2,
> > so the parser propably recognizes them.
>
> No - the parser is supposed to be able to _parse_ them (in case they are
> allowed in future levels of CSS), but is certainly not supposed to
> _recognize_ them.

I haven't looked into the details of this specific case, but in order to 
support forward compatible parsing parsers sometimes have to try to 
"recognize" things that aren't presently allowed simply to be able to parse 
the rest properly. But of course, anyone arguing on this point here is 
probably splitting hair :-)

> > That would for the implementation be basically the same thing as
> >
> >   @media print      { @page { /* ... */ } }
> >   @media projection { @page { /* ... */ } }
>
> No no.  Just use media dependent @import and stick the rules in separate
> style sheet.  Works fine today for UAs that support @import and @page.
>
> @import "printsheet.css" print;
> @import "projsheet.css" projection;

That's true but at the same time seems to call for good reasons to be this 
way. In order to comply with forward compatible parsing parsers are bound to 
try to parse atrule-blocks within at rules, if only to discard them properly 
because they are not part of the present grammar (otherwise they're not 
forward compatible, and I guess that a number aren't).

Had forward compatible parsing not been part of the picture I'd have accepted 
the argument according to which parsing 1-depth is easier, because it's 
obviously true. But in the case of CSS, I believe it isn't. To paraphrase, 
"n-depths could happen".

> It makes style sheets easier to read.  CSS is supposed to be easy to write
> AND read.

This is a valid concern, but I don't think that forcing people to put their 
CSS in separate files to make this works makes it simpler to read (it 
certainly makes simple sheets harder).

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

I doubt anyone wants to nest 15 levels of at rules, and if they do it's 
probably their problem :-) However, nesting two-three levels wouldn't look 
bad given proper indentation, and in any case using import for that would 
start looking like a pre-processors file, or put lots of indirection in the 
face of the casual user (imagine having to open 12 files in a row containing 
each time only includes to other files !).

-- 
_______________________________________________________________________
Robin Berjon <robin@knowscape.com> -- CTO
k n o w s c a p e : // venture knowledge agency www.knowscape.com
-----------------------------------------------------------------------
Design a system that even an idiot will be able to use, and only an 
idiot will want to use it.

Received on Saturday, 11 August 2001 16:05:55 UTC