- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Mon, 10 Jun 2013 07:53:59 -0700
- To: Boris Zbarsky <bzbarsky@mit.edu>
- Cc: public-webapps <public-webapps@w3.org>
On Sun, Jun 9, 2013 at 6:18 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote: > On 6/9/13 7:35 PM, Timmy Willison wrote: >> I was a little confused. I realized something I already knew in that >> elem.querySelector[All] does limit the matched set to the descendants of >> element > > Right. But find() does not, for what it's worth, depending on the exact > selector used. It can return sublings of the context object, for example, > as far as I can tell. Hence the wording difference. Specifically, "el.find('+ div');" will work, and find the sibling <div> to the context element. "el.querySelector(':scope + div');" will *not* work, because the results are first filtered to be only descendants of the context element. The wording is slightly confusing now, but in Selectors 4 terminology, selectors in find() are *relative*, but not *scoped*. Selectors in qSA() are scope-filtered. (They may also be relative - it's been a while since I read the spec, so I don't remember.) ~TJ
Received on Monday, 10 June 2013 14:54:46 UTC