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

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

From: Dave Methvin <dave.methvin@gmail.com>
Date: Wed, 20 Jun 2012 10:52:17 -0400
Message-ID: <CACnq-uKALOFcggSzK=jSEy_xEaU4Kiv+C65k7aidi63C2V5yZg@mail.gmail.com>
To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Cc: Charles McCathieNevile <chaals@opera.com>, "Tab Atkins Jr." <jackalmage@gmail.com>, Elliott Sprehn <esprehn@gmail.com>, Simon Pieters <simonp@opera.com>, "Kang-Hao (Kenny) Lu" <kennyluck@csail.mit.edu>, "public-webapps.w3.org" <public-webapps@w3.org>
> 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.

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

This archive was generated by hypermail 2.3.1 : Wednesday, 11 February 2015 14:36:59 UTC