Re: CSS Hierarchies / Selector Nesting Proposal

On Fri, Jun 3, 2011 at 3:13 PM, Boris Zbarsky <> wrote:
> On 6/3/11 3:06 AM, Tab Atkins Jr. wrote:
>> Yes, it's intended that things like "&input" be supported.  The
>> restriction for tagname selectors to be the first part of a complex
>> selector is solely because we can't distinguish the start of a tagname
>> selector from the end of another selector.
> Wait.  So I thought I understood the proposal, but now I see that I don't.

For a moment I felt exactly the same, but I think there are some cases
where the "&input" construct could make sense (not sure if they are
worth the extra implementation complexity, but that I'll let you,
implementors, to decide).

If I got it right, then something like this:
:hover {
    &input { color: red; }
    &span { color: blue; }
should be equivalent to this:
input:hover { color: red; }
span:hover { color: blue; }

And would be equivalent to this:
:hoverinput { color: red; }
:hoverspan { color: blue; }
if it weren't for the issue that there is no way to tell the pclass
and element apart.

While it looks like an interesting feature, personally I'd prefer a
simpler implementation being available sooner than having to wait
longer just for this "extra".

Of course, I may have gotten it all wrong, so better wait for Tab to
confirm or correct this :P

Eduard Pascual

Received on Friday, 3 June 2011 13:36:09 UTC