- From: Andrew Fedoniouk <news@terrainformatica.com>
- Date: Sun, 13 Jul 2008 17:37:36 -0700
- To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- CC: www-style <www-style@w3.org>
Lachlan Hunt wrote: > Andrew Fedoniouk wrote: >> Am I correct in my understanding that: >> >> localRoot.querySelector("div") >> >> will mean precisely: >> >> localRoot.querySelector(":context div") > > In that particular case, yes, because the results are restricted to > elements contained within the context node. But not in this case: > > foo.querySelector("div div"); > > That is not the same as either > > foo.querySelector(":context div div") > > And similarly when using other combinators. This is all clearly > explained in that email I linked to before. > Could you add to your cases also this: scoped style set { p:root > button { background-color:yellow; } li:root > button { background-color:green; } } ? That is practical case we use in scoped style sheets. This allows to apply the same set to different elements - so to reuse it. I mean that for the method like foo.querySelector(">button") that implied :scope on the left would probably work but for scoped selectors (that presumably shall use the same implementation) having something like [type="calendar"]:root is highly desired. We ended up with Solution #1 combined with Solution #3 that is: In scoped selector :root is evaluated to the root element of the scope and lookup happens on the set including element itself and all its descendants. So we have[1] in fact following: 1) element.select([callback,] selector) - :root is the element. 2) element.selectParent([callback,] selector) - :root is the global root. 3) element.match(selector) - :root is the global root. This covers all methods found in jQuery. My 3 cents. -- Andrew Fedoniouk. http://terrainformatica.com [1] the Sciter, microDOM implementation: http://www.terrainformatica.com/sciter/Element.whtm
Received on Monday, 14 July 2008 00:38:18 UTC