- From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- Date: Mon, 11 Jan 2010 10:55:23 +0100
- To: Boris Zbarsky <bzbarsky@MIT.EDU>
- Cc: Sean Hogan <shogun70@westnet.com.au>, public-webapps <public-webapps@w3.org>
Boris Zbarsky wrote: > On 1/10/10 11:58 PM, Sean Hogan wrote: >> Even if jQuery deprecates non-standard selectors, the current spec for >> queryScopedSelector*() doesn't support the jQuery implicitly "scoped" >> selector "> *". > > As I understand it, jquery selectors on elements are always scoped in > the sense that they behave differently from the v1 Selectors API. In > particular, if I understand correctly, the behavior of: > > element.querySelector("body div") > > in matching all <div>s that are descendants of |element| and also > descendants of a <body> (which may be an _ancestor_ of |element|) is > different from the selector behavior in jquery. Yes. > All that said, I just read the draft at > http://dev.w3.org/2006/webapi/selectors-api2/ and I can't make heads or > tails of either what the new arguments to querySelector(All) are > supposed to mean (are they just an enumaration of the things :scope is > allowed to match during the selector evaluation?) When there's no reference nodes passed and no :scope selector used, the behaviour of querySelector and querySelectorAll is unchanged from v1. If there is a :scope selector used, then it matches the context node. If there are also additional reference nodes passed, then :scope will instead match any of the elements in given collection. or what > queryScopedSelector(All) is supposed to do. Am I just missing something? > Am I reading the wrong draft? > > (I'd link to the "dated" version of the draft, in case it changes, but > that link is broken, sadly.) You can link to the CVS revision instead. The link to the dated version in the page header is generated automatically by the spec generator, regardless of whether it actually exists or not. >> In the following forms :scope is misleading: >> >> element.queryScopedSelector(":scope + *") >> element.queryScopedSelector(":scope ~ *") What's misleading about that? :scope would match the context node (what the element variable points to), and would return its sibling elements. >> and especially: >> >> element.querySelector("* :scope *", refNode) Again, how is that misleading? :scope matches whichever element refNode points to, and then follows the normal rules for evaluating querySelector. Given that selector, any descendents of refNode that are also descendents of element (the context node) will be matched, the first of which will be returned. -- Lachlan Hunt - Opera Software http://lachy.id.au/ http://www.opera.com/
Received on Monday, 11 January 2010 09:55:58 UTC