Re: Opera's Proposal for :context Selector

Lachlan Hunt wrote:
>
> Brad Kemper wrote:
>> Since querySelector() is still experimental, it can still be changed. 
>> Could the CSS WG say that in the case of selectors that are used in 
>> fragments such as this, that :root refers to the root of the 
>> fragment, in this case the element represented by "foo"? So in that 
>> case the following should do what you want:
>>
>> foo.querySelector(":root div");
>
> I do not understand the where desire to reuse :root for this is coming 
> from, nor why introducing a new pseudo-class to address the problem 
> instead is in any way bad?
Consider this case
<html>
  <body>
     <div>
        <p id="foo"><span>...</span></p>
    </div>
  </body>
</htmL>

And  foo.querySelector("div span");

Question is: would you expect this function to return anything?
If yes then  *all* selectors inside scoped style sheets *must* be
prepended with the :context. Not quite useful.

element.querySelector() *must* work as if the element is the :root so
is isolated from the rest of the tree.
Otherwise you will get unpredictable errors that is very hard to
catch - in different environments/contexts element.querySelector() will 
return
different results. Too bad.

-- 
Andrew Fedoniouk.

http://terrainformatica.com

Received on Friday, 11 July 2008 18:37:15 UTC