Yehuda Katz (ph) 718.877.1325
On Thu, Nov 24, 2011 at 9:47 AM, Boris Zbarsky <[email protected]> wrote: > On 11/23/11 5:38 PM, Sean Hogan wrote: > >> - If you want to use selectors with :scope implied at the start of each >> selector in the selector list (as most js libs currently do) then you >> use find / findAll / matches. >> > > I'm not sure that for matches() the :scope thing is all that relevant. > :matches() just returns a boolean for whether the |this| it's invoked on > matches the selector. The only reason one would ever use :scope in there > at all is if one provides an explicit list of reference nodes, right? In > particular, the assumption is that the selector passed in would obviously > be allowed to match ancestor nodes of |this| for parts of it, since > otherwise there is no point, right? No one would expect > > foo.matches("div *"); > > to always return false; you would expect it to return true if |foo| has an > _ancestor_ matching "div". > > Similarly, no one would expect this: > > foo.matchs(" > div"); > > to do much of anything, I would think. Or am I wrong on that? > To my ignorant eyes, you seem correct. > > Am I just missing something here? > > -Boris > >
