Re: CSS Hierarchies / Selector Nesting Proposal

On Thu, Jun 2, 2011 at 12:16 PM, Brad Kemper <brad.kemper@gmail.com> wrote:
> On Jun 2, 2011, at 9:09 AM, Boris Zbarsky <bzbarsky@MIT.EDU> wrote:
>
>> On 6/2/11 11:48 AM, Brad Kemper wrote:
>>> OK, I see the issue now. By inserting the ampersand token, you are being more explicit with regard to space handing.
>>
>> Yeah, the use of ' ' as a combinator is sort of killing us here.  :(
>>
>>> If the use case for each of those two examples is equally strong
>>
>> I think that the use cases for the "#foo.bar" and "#foo .bar" selectors are equally strong, yeah.  They're both pretty commonly used.  For ":hover" instead of ".bar" the use case for the descendant combinator is less strong, but I don't think we should have different parsing rules for ":hover" and ".bar" here.
>
> I meant in terms of embedding one ruleset inside another, are the organizational benefits the same for pseudo-class selectors as for defendant selectors? Or would the tradeoff of not embedding the pseudo-class rule inside another rule be worth it in order to not have to write as many ampersands, as you could still write the pseudo-class rules normally and be reasonably organized with a net gain overall. I'm more or less playing devil's advocate here, as I suspect the answer is "no".

It's definitely still very valuable.  For example, if you have a
relatively long selector to select a button, you can use nesting to
style the :hover and :active states without repeating yourself.

There are similar use-cases for having a pseudo with a descendant
selector - for example, selecting an element via a long selector, then
targeting an :nth-child() of the element.

~TJ

Received on Friday, 3 June 2011 04:36:01 UTC