- From: Robin Berjon <robin@w3.org>
- Date: Wed, 11 Sep 2013 22:49:46 +0200
- To: Boris Zbarsky <bzbarsky@MIT.EDU>
- CC: public-webapps@w3.org
On 11/09/2013 17:22 , Boris Zbarsky wrote:
> On 9/11/13 9:52 AM, Rick Waldron wrote:
>> A prime use case: a cache of selector objects that are useful when
>> matching event.target for event handler delegation patterns.
>
> Note that UAs already do some internal caching of parsed selector
> objects used with querySelector. Of course an explicit cache in the
> script would likely be a tiny bit faster.
On IRC Domenic pointed out that the primary apparent usage for this
mirrors jQuery's .is(). Barring the caching case, it seems unlikely to
be appealing to do (new Selectors("div")).matches(el) instead of
el.matches("div").
One thing that /could perhaps/ be interesting with this though would be
as an extensibility point in which developers could bind parameters and
functions extending selectors. A selector object would be a logical
place to hang this off of. But that's a whole other kettle of fish.
--
Robin Berjon - http://berjon.com/ - @robinberjon
Received on Wednesday, 11 September 2013 20:49:56 UTC