Re: Opera's Proposal for :context Selector

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).

-- 
Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth

Received on Monday, 14 July 2008 21:18:12 UTC