Re: Nesting declaration blocks

* Tab Atkins Jr. wrote:
>> Without stating preferences, could this be written without “nest”, “this” and parentheses?
>>
>>  #header {prop: value;
>>    @ img {prop: value;}
>>    @> nav {prop: value;}
>>  }
>>
>>  body > article.post > form input[type=checkbox] {prop: value;
>>    @:checked {prop: value;}
>>  }
>>
>>  my > long > selector > string {prop: value;
>>    @::before {prop: value;}
>>  }
>
>Not easily.  The syntax of @-rules is that they must start with an "@"
>followed by an identifier.
>
>I'm not sure if I could omit the () or not.  It would be ideal if I
>could, though.

As far as the current specification is concerned, the requirement is to
read, when looking for a declaration, up to the end of the declaration,
recognizing all the quoting and nesting constructs in the process. The
end of a declaration is either the closing `}` of the containing rule-
set or a `;` at the right level. Since selectors do not use `;` at the
top nesting level there is no problem with omitting the identifier or
omitting the parens, as far as conforming implementations are concerned.
There of course never has been a conforming CSS parser, so this would
require a good amount of testing if you care about graceful degradation,
but that's necessary with this proposal anyway.
-- 
Björn Höhrmann · mailto:[email protected] · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Wednesday, 20 October 2010 19:57:08 UTC