Re: Thinking about mixins as a new type of selector

On Aug 16, 2012 3:53 AM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:
>
> On Wed, Aug 15, 2012 at 5:38 PM, Brian Kardell <bkardell@gmail.com> wrote:
> > On Aug 15, 2012 8:18 PM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:
> >> Example 4
> >> =========
> >> SASS:
> >> #admin .tabbar a {font-weight: bold}
> >> #demo .overview .fakelink {@extend a}
> >>
> >> CSS:
> >> @matches $link a;
> >> #admin .tabbar $link {font-weight: bold}
> >> @matches $link #demo .overview .fakelink;
> >>
> >> Equivalent Vanilla:
> >> #admin .tabbar a,
> >> :matches(#admin .tabbar .fakelink):matches(#demo .overview .fakelink) {
> >>   font-weight: bold;
> >> }
> >
> > Is the SASS/vanilla right in example 4?  If so, can someone explain
that?  I
> > get David's in that example, but how you go from the SASS to that I am
> > having trouble following.  Feel free to reply offlist if you think it is
> > irrelevant...just wanted to record my confusion and get a correction if
> > necessay.
>
> The vanilla is right, it just involves a more powerful variant of
> :matches() than currently exists in Selectors, where it accepts
> complex selectors.
>
> Given "A B $C {...} @extend $C X Y Z;", you match Z elements which
> both have "A B" and "X Y" as ancestors.
>
> ~TJ

Ah, I see now.  Got it, thanks.
Subject selector / :has()  would make this extra fun :)

Received on Thursday, 16 August 2012 12:36:20 UTC