W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: Opera's Proposal for :context Selector

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 14 Jul 2008 16:23:04 -0500
Message-ID: <dd0fbad0807141423vb24835cr6c3418b273187c16@mail.gmail.com>
To: "Joshua Cranmer" <Pidgeot18@verizon.net>
Cc: "Andrew Fedoniouk" <news@terrainformatica.com>, "Lachlan Hunt" <lachlan.hunt@lachy.id.au>, www-style <www-style@w3.org>

On Mon, Jul 14, 2008 at 4:17 PM, Joshua Cranmer <Pidgeot18@verizon.net> wrote:
> Tab Atkins Jr. wrote:
>>
>> I agree here, though, that *without* a :scope or :context pseudoclass,
>> it can be difficult to achieve proper modularity.  Frex, in this
>> fragment:
>>
>> <section>
>>  <style scoped>
>>    div span { color: red }
>>  </style>
>>  <span>span content</span>
>>  <div>
>>    <span>some more span content</span>
>>  </div>
>> </section>
>>
>> The second span will definitely be red, but the first will be red
>> depending on whether or not there is a div somewhere further up the
>> ancestor chain.
>>
>
> This sounds as if it's a bug. As  developer, I would intuitively expect such
> a document fragment to have the same results regardless of extra content.
> Whether or not the section is wrapped in a div or not should not (IMHO)
> affect the styles generated by the scoped stylesheets. I fail to see a
> compelling use case that calls for the scoped stylesheets to be
> knowledgeable of the existence of any elements outside the scoped root
> (e.g., the section).

Being able to do a query against the full document *is* useful, but
you need some way to specify that you want a selector to *only* query
against the elements in scope, or you get the unintuitive results that
you mentioned.  That'd be the :scope/:context pseudoclass.

~TJ
Received on Monday, 14 July 2008 21:23:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:10 GMT