Re: Nesting declaration blocks

On Tue, Oct 19, 2010 at 1:34 AM, Christoph Päper
<christoph.paeper@crissov.de> wrote:
> Tab Atkins Jr.:
>>
>> Using @-rules, you could introduce nesting with only the minimal grammar breaking we talked about.
>
> Minimal breaking is like minimal pregnant.

Heh, granted.  However, we'd already talked about changing the Core
Grammar here to allow this style of construct.


>> #header {prop: value;
>>  @nest(img) {prop: value;}
>>  @nest(> nav) {prop: value;}
>> }
>>
>> body > article.post > form input[type=checkbox] {prop: value;
>>  @this(:checked) {prop: value;}
>> }
>>
>> my > long > selector > string {prop: value;
>>  @this(::before) {prop: value;}
>> }
>
> 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.


> What result would the following ruleset give for “foo”?
>
>  foo {
>    color: green;
>    @> bar {bar: quuz;};
>    color: red; background: orange;
>  }
>
> Was it any different without the semicolon?
>
>  foo {
>    color: green;
>    @> bar {bar: quuz;}
>    color: red; background: orange;
>  }
>
> I would expect red on orange for the first case and green on orange for the second one, but I assume you would spec green on transparent for both cases.

I'd prefer your interpretation on both cases, actually.  The only
wrinkle is whether or not we require @-rules in declaration blocks to
come at the end of the decl block (for maximum compatibility with
legacy user agents).

~TJ

Received on Wednesday, 20 October 2010 19:33:44 UTC