Re: CSS Hierarchies / Selector Nesting Proposal

Speaking as an author, not only is this a fantastic idea for stylesheet
organization, but I think that it would be better to make the ampersand
explicit. That way, authors don't have to go to the spec to check the exact
parsing behavior (because authors should know that the ampersand starts the
continuation of the parent selector, as it were), and we don't have browsers
trying to guess what authors meant with spaces and not-spaces and so on.
(They shouldn't be, because the spec will be explicit, but I think it's
important to guard against some parser trying to be clever.) In short, I
guess, it will help with debugging to be explicit in this scenario.

On a totally different note, in this plan, what happens if there is an
ampersand in an unnested selector:
&.bar { /* ... */ }

My guess is that is just acts as if the ampersand is not there. I suppose
it's fairly easy to build the parser so that it handles these correctly
(correctly being that each of these selectors matches every .bar, assuming
people agree with my suggestion of how to handle the case of "&.bar"):

&.bar { /* ... */ }
& .bar { /*...*/)

-Eli Morris-Heft

Received on Thursday, 2 June 2011 19:41:04 UTC