Re: CSS Hierarchies / Selector Nesting Proposal

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 UTC