- From: Andrew Fedoniouk <news@terrainformatica.com>
- Date: Sun, 13 Jul 2008 15:47:30 -0700
- To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- CC: fantasai <fantasai.lists@inkedblade.net>, www-style <www-style@w3.org>
Lachlan Hunt wrote: > > fantasai wrote: >> Have you considered handling these queries by passing an option to >> querySelector that scopes the selector to the context node? (Or in the >> case of HTML5 scoped style, defining a syntax for the style element >> that does the same.) What are the advantages of doing this with a >> pseudo-class instead of that approach? > > I did a full analysis of that and other possible solutions previously on > public-webapi. > > http://lists.w3.org/Archives/Public/public-webapi/2008May/0057.html > http://lists.w3.org/Archives/Public/public-webapi/2008May/0058.html > > The solution discussed in that second email is being considered for > Selectors API 2, where a new method would be introduced that performs a > pre-parse on the group of selectors, appends :context to the beginning > of each selector and then parses as normal. This will provide implicit > scoping and basically standardise the defacto standard of many JS > libraries, but the explicit :context gives a little more flexibility. So > both would be useful. Am I correct in my understanding that: localRoot.querySelector("div") will mean precisely: localRoot.querySelector(":context div") ? If "yes" then lookup happens *always* from the localRoot element and that element is exactly the :root in such selectors. That is why I do not understand why you need special :context pseudo if we have :root already. > > This is the feature request bug I have for tracking that proposal. > > http://www.w3.org/Bugs/Public/show_bug.cgi?id=5860 > -- Andrew Fedoniouk. http://terrainformatica.com
Received on Sunday, 13 July 2008 22:48:12 UTC