W3C home > Mailing lists > Public > www-style@w3.org > June 2011

Re: CSS Hierarchies / Selector Nesting Proposal

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 3 Jun 2011 19:22:19 -0700
Message-ID: <BANLkTin24X-N=K0bsyBo6FOV-drv4vDwhg@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: www-style@w3.org, Eduard Pascual <herenvardo@gmail.com>
On Fri, Jun 3, 2011 at 6:49 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 6/3/11 9:38 AM, Boris Zbarsky wrote:
>> On 6/3/11 9:35 AM, Eduard Pascual wrote:
>>>
>>> For a moment I felt exactly the same, but I think there are some cases
>>> where the "&input" construct could make sense
>>
>> Sure. I just no longer understand what the proposed processing model is,
>> past "do something that's in Tab's head".
>
> In particular, should this work?
>
> .foo {
>  body > & { color: green; }
>  #bar & .baz { color: blue; }
> }
>
> ?  If not, why not?

We'd love that to work, but it unfortunately allows the ambiguity
where a selector can look like a property:

.foo {
  bar:hover a a a a a a a a a a a a a a & { color: green; }
}

This looks like a property named "bar" with a value of "hover a a
a..." up until the point we see the {.

This was listed as a concern with previous incarnations of the idea.
If it's no longer a problem, then let's relax the restriction and rock
out, because it's totally useful to be able to do that.


Another option is to use a more explicit indicator at the start, like:

.foo {
  @nest {
    body > & { color: green; }
    #bar & .baz { color: blue; }
  }
}

This is a bit more verbose, however, and we wanted to avoid verbosity.
 I'm not violently opposed to this, though.

~TJ
Received on Saturday, 4 June 2011 02:23:09 GMT

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