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

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

From: Roland Steiner <rolandsteiner@google.com>
Date: Wed, 21 Sep 2011 08:58:39 +0000
Message-ID: <CACFPSpitvue8BueNjzQwvYYPgGWvRvuVNQzo87xOJWKre3bUNQ@mail.gmail.com>
To: fantasai <fantasai.lists@inkedblade.net>
Cc: Ian Hickson <ian@hixie.ch>, www-style@w3.org
On Wed, Sep 21, 2011 at 5:32 AM, fantasai <fantasai.lists@inkedblade.net>wrote:

> On 09/20/2011 05:22 PM, Ian Hickson wrote:
>
>> On Tue, 20 Sep 2011, fantasai 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>
>>>
>>
>> ...what element does the :context() match against?
>>
>
> The one defining the scope.
>

If I understand correctly, then this could also be written as

body.homepage :scope h1 { color: red }

If so, then this is the exact original proposal on
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-June/032056.html to
extend selector matching iff :scope and/or :root is present.
But as Hixie pointed out in that thread, this means that a more specific
selector (one that includes :context/:scope/:root) matches _more_ elements
than a less specific one (i.e., one that doesn't).


- Roland
Received on Wednesday, 21 September 2011 08:59:24 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:04 UTC