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

>
>
> It should be noted that JQuery/sizzle does not use querySelector() at all,
> AFAICS. It only uses querySelectorAll() and sometimes switches to
> .getElementById() or document.body.
>
>
I took a look at using querySelector as an optimization a while back but it
did not seem to make a significant difference in speed, at least once the
library overheads were included. This test html is based on the
msn.comhome page to be representative of a big real-life document.
http://jsperf.com/findone-vs-findall

The reason we switch to getElementById is because querySelectorAll is much
slower for that case. qSA can retrieve multiple elements in invalid
documents with duplicate IDs, but that's not a case we are worried about.

Received on Wednesday, 20 June 2012 15:38:29 UTC