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

Re: Opera's Proposal for :context Selector

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Fri, 11 Jul 2008 11:36:25 -0700
Message-ID: <4877A829.9040606@terrainformatica.com>
To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
CC: Brad Kemper <brkemper@comcast.net>, www-style <www-style@w3.org>

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 GMT

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