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

[whatwg] Selectors within <style scoped>

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 16 Jun 2011 10:40:48 -0700
Message-ID: <BANLkTin4+Q8_+FtKux0g9PGCmRgwfG1EpA_UM1emt7mb9vxT0g@mail.gmail.com>
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.

Received on Thursday, 16 June 2011 10:40:48 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:34 UTC