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

On 09/19/2011 04:12 PM, fantasai wrote:
> On 09/19/2011 03:58 PM, Tab Atkins Jr. wrote:
>> Summary
>> -------
>> HTML is defining <style scoped> in a way which best matches author
>> intuitions, but which is limited in some ways. I propose @global as a
>> way to get around those limitations while maintaining the
>> intuitiveness benefits. Hixie wrote an email explaining the relevant
>> reasoning and suggesting this proposal at
>> <>.
> What's the use case for this, i.e. do we actually need to solve this problem?

Hixie gave some good use cases here:

 From the use cases it seems to me the idea is not "make this match across
the entire tree and filter the results" but rather "here I want to match
against some contextual information that's outside my scope".

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; }


Received on Tuesday, 20 September 2011 23:59:54 UTC