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

Re: Nesting declaration blocks

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 20 Oct 2010 13:02:34 -0700
Message-ID: <AANLkTimQeNP2aSsjZgzrYrJsTcBPhynj3-yJFcWAjBWn@mail.gmail.com>
To: Bjoern Hoehrmann <derhoermi@gmx.net>
Cc: Christoph Päper <christoph.paeper@crissov.de>, www-style list <www-style@w3.org>
On Wed, Oct 20, 2010 at 12:56 PM, Bjoern Hoehrmann <derhoermi@gmx.net> wrote:
> * 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.

Yeah, that's what I decided after reading the appropriate section of
CSS2.1.  So () are unnecessary.

~TJ
Received on Wednesday, 20 October 2010 20:03:27 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:33 GMT