W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 20 Jun 2012 12:09:09 -0400
Message-ID: <4FE1F5A5.3030801@mit.edu>
To: public-webapps@w3.org
On 6/20/12 11:34 AM, Marat Tanalin | tanalin.com wrote:
> It's natural to suppose that searching for just _first_ matching element and returning immediately once it's found should be much _faster_ than searching for _all_ matching elements (be it 100 or 1000 elements) even if we need just first one.

It's natural to suppose that, but it would be wrong if the majority of 
the time is spent setting up the search (e.g. preprocessing the 
selector, which jQuery does), not actually searching....

> For example, I very like `querySelector()` and use it at least as much as (and maybe even more often than) `querySelectorAll()`.

If you're calling these directly, there's a lot less preprocessing going on.

-Boris
Received on Wednesday, 20 June 2012 16:09:47 GMT

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