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

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
scenarios.
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>
wrote:
>> So, given that, rather than having a "scoped vs. global" switch, how
about
>> 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