Re: Nesting declaration blocks

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 UTC