- From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- Date: Fri, 11 Jul 2008 18:24:46 +0200
- To: Brad Kemper <brkemper@comcast.net>
- Cc: www-style <www-style@w3.org>
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?
Another problem with redefining :root is that if some browsers ship
support querySelector with the new handilng of :root, and others with
the current meaning, then that will create interoperability issues
because :root will match entirely different elements.
consider this case:
<html>
<body>
<div id="foo">
<div>...</div>
<div>...</div>
</div>
</body>
</htmL>
foo.querySelectorAll(":root>div");
In browsers with support for the redefined :root, that will match the 2
child div elements. In browsers with support for :root as currently
defined, it will not match any of the div elements.
At least with the new pseudo-class, shipping without support means that
a SYNTAX_ERR will be thrown, which can then be caught and scripts can
compensate with their own backup processing.
--
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/
Received on Friday, 11 July 2008 16:25:24 UTC