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

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 14:50:03 UTC