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 12:32:50 -0700
Message-ID: <AANLkTino7ezfAKt=nLog2Dq2OhDNPPvn9K+8CW7Cb6f2@mail.gmail.com>
To: Christoph Päper <christoph.paeper@crissov.de>
Cc: www-style list <www-style@w3.org>
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 GMT

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