Re: Opera's Proposal for :context Selector

On Mon, 14 Jul 2008 19:06:51 +0200, Lachlan Hunt  
<lachlan.hunt@lachy.id.au> wrote:
> [...]

FWIW, reading the various arguments here I think re-using :root does make  
some sense. It would be a simple change to the Selectors specification at  
somewhat lower cost than introducing a new pseudo-class. Working together  
with "scoped style sheets" might actually have been a goal with :root, but  
I only recall that from informal conversation and don't have actual  
pointers.

However, re-using :root would mean that you can't select descendants of  
the context element based on specifics of the root element. That is, with  
Lachlan's proposal you can do

   svg:root > g:context > :link

to only select :link children of SVG <g> elements that are directly a  
child of the root SVG <svg> element rather than SVG <g> elements that are  
child of any SVG <svg> element. (SVG documents can contain several <svg>  
elements, one of them being the root element.)

With the proposal from various other people here that would no longer be  
possible, as in that case

   svg:root > g:root > :link

would match nothing, because the context element can't be two elements at  
the same time.

Given the potential that basing Selectors on the root element might become  
more significant in the future, I think Lachlan's proposal is slightly  
better, but I would probably be ok either way.


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>

Received on Monday, 14 July 2008 18:29:15 UTC