W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2011

[whatwg] Selectors within <style scoped>

From: Dimitri Glazkov <dglazkov@chromium.org>
Date: Thu, 16 Jun 2011 11:32:42 -0700
Message-ID: <BANLkTikZeOxPVxDZuHz5os3wMzEUWLyYWWdsFVkRGoCMTh2WLg@mail.gmail.com>
What if we do this:

1) By default, <style scoped> implies that all selectors in this
stylesheet are prefixed with ":scope".
2) Unless the ":scope" is already in the selector.

:DG<

On Thu, Jun 16, 2011 at 10:40 AM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:
> On Thu, Jun 16, 2011 at 10:28 AM, Dimitri Glazkov <dglazkov at chromium.org> wrote:
>> But looking at this with my Web developer hat on, I would almost
>> _always_ prefix scoped rules with :scope, just to be safe. I certainly
>> don't want my ".closed .foo { display:none }" to start reacting to
>> some doofus syndicating my code in the wrong way. I can see how this
>> logic quickly downgrades ":scope" to syntactic shellack.
>>
>> I think we should ask how Web developers would view this. I am pretty
>> sure that their intuitive understanding of <style scoped> is that all
>> rules are implicitly prefixed with ":scope".
>
> As a web developer, I agree - my intuitive understanding of @scoped is
> that it makes matching *start* at the scoped element. ?That's what
> "scoped" means. ?The other meaning is more like a filter.
>
> I was convinced that @scoped worked exactly like this until this
> thread. ?Apparently my previous reading of the spec was insufficiently
> deep to spot the scoping/filtering difference.
>
> FWIW, I also think that querySelector got this wrong. ?It should have
> scoped by default, and then possibly also offered an option to filter
> based on an element.
>
> ~TJ
>
Received on Thursday, 16 June 2011 11:32:42 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:06 UTC