Re: [selectors-api] Consider backporting find() behavior to querySelector()

20.06.2012, 18:14, "Lachlan Hunt" <lachlan.hunt@lachy.id.au>:
> 4. Support for returning elements that are not descendants of the
> ššššcontext object.
>
> This feature allows a selector to be constructed such that it matches an
> element anywhere in the tree relative to the context element. This
> feature is not relevant to document.find(), since it can already return
> anything from the whole tree.
>
> šššelm.find("+span") ššššššš// span is a sibling
> šššelm.find("/for/ input") š// input could be anywhere
> šššelm.find(":not(:scope)") // Everything except the context object
>
> This feature cannot be supported on Element.qSA, even when using eplicit
> :scope, because matching elements need to be descendants of the context
> object.

It's unclear why an _updated_ qSA version should have same limitation that "matching elements need to be descendants of the context object". There is nothing obvious that makes h1.querySelector('+ H2') impossible to work in newer implementations (in older ones it would not work anyway -- to the same extent as `elm.querySelector(">span")` that you've declared as "could work").

Received on Wednesday, 20 June 2012 15:47:28 UTC