W3C home > Mailing lists > Public > www-style@w3.org > October 2010

Re: Nesting declaration blocks

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Wed, 20 Oct 2010 21:56:28 +0200
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Christoph Päper <christoph.paeper@crissov.de>, www-style list <www-style@w3.org>
Message-ID: <shhub61v1k2s5va26u4esof5nou543orv0@hive.bjoern.hoehrmann.de>
* 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:bjoern@hoehrmann.de · 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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:40 UTC