- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Wed, 20 Jun 2012 12:09:09 -0400
- 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 UTC