W3C home > Mailing lists > Public > www-style@w3.org > September 2011

Re: Suggestion for @global to help with <style scoped>

From: Brian Kardell <bkardell@gmail.com>
Date: Wed, 21 Sep 2011 11:05:35 -0400
Message-ID: <CADC=+jdZOiKZjJ1-FnP1G=XE8z8uh_d4jBKn5riYMB28CH8Z=g@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style@w3.org, fantasai <fantasai.lists@inkedblade.net>
I apologize if I missed this reading through the whatwg threads, but
thinking about this with things like xbl in mind as well: is the goal merely
to "limit the leaking" of styles outside the scope unless you really mean it
or to truly encapsulate (disallow leaking outside the scope, but allow you
to use the containing context in your match)?  Either way I am wondering how
other conversations about selecting the subject play into possible
On Sep 21, 2011 10:51 AM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:
> On Tue, Sep 20, 2011 at 4:59 PM, fantasai <fantasai.lists@inkedblade.net>
>> So, given that, rather than having a "scoped vs. global" switch, how
>> using a pseudo-class to distinguish whether a portion of the selector is
>> matching out-of-scope elements? E.g.
>>     <style scoped>
>>      section > h1 { border-bottom: solid; }
>>      :context(body.homepage) h1 { color: red; }
>>      :context(body.archive) h1 { color: gray; }
>>     </style>
> Is the :context() pseudo only valid at the start of the selector?
> That is, is it invalid and/or meaningless to do "body
> :context(section.homepage) h1"?
> If so, then I don't see what benefit this has over the @global switch.
> It seems that it's a trivial syntax transformation:
> @global body.homepage h1
> to
> :context(body.homepage) h1
> This is also very slightly weaker, in that you can't write a selector
> with a section that may match inside *or* outside the scope. You can
> do that with @global by just avoiding the use of :scope. With
> :context(), however, the "outside the scope" and "inside the scope"
> sections are always explicitly marked and separate.
> ~TJ
Received on Wednesday, 21 September 2011 15:06:04 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:04 UTC