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

On 09/21/2011 10:12 AM, Ian Hickson wrote:
> On Tue, 20 Sep 2011, fantasai 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.
>
> So basically :context(...) is like :scope:matches(... #) ?

Yes. Although I was thinking of having these work differently:

   :context(blockquote) > p { ... }
   :context(blockquote) p { ... }

So :context(...) would be more like

:scope-or-ancestor-of-scope:matches(...)

~fantasai

Received on Wednesday, 21 September 2011 19:31:08 UTC