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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 21 Sep 2011 07:49:15 -0700
Message-ID: <CAAWBYDC25P-_1wV62Rqm9vM_XTQWDTL64grFd6h6V7mqjtTVKQ@mail.gmail.com>
To: fantasai <fantasai.lists@inkedblade.net>
Cc: www-style@w3.org
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:44 GMT