W3C home > Mailing lists > Public > www-style@w3.org > August 2012

Re: Thinking about mixins as a new type of selector

From: Brian Kardell <bkardell@gmail.com>
Date: Thu, 16 Aug 2012 08:35:49 -0400
Message-ID: <CADC=+jciNwN5zikTUVCyaEw786FDYLDOprauq+wBTQ6cfrvB6Q@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style@w3.org, "L. David Baron" <dbaron@dbaron.org>
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:58 GMT