W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: [Selectors API 2] Is matchesSelector stable enough to unprefix in implementations?

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 24 Nov 2011 12:47:44 -0500
Message-ID: <4ECE8340.6060305@mit.edu>
To: Sean Hogan <shogun70@westnet.com.au>
CC: Lachlan Hunt <lachlan.hunt@lachy.id.au>, public-webapps@w3.org
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?

Am I just missing something here?

-Boris
Received on Thursday, 24 November 2011 17:48:19 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:49 GMT