Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is jQuery currently using native query selector API?

I am wondering this question,

is jQuery currently using native query selector API?

from this benchmark: http://jsperf.com/jquery-vs-document-queryselector

the performance of native API is dramatically faster than jQuery library

will jQuery use the native API to increase query performance?


1 Answers

If you look at the latest codebases:

1.11.1 https://github.com/jquery/jquery/blob/1.11.1/dist/jquery.js#L1200

2.1.1 https://github.com/jquery/jquery/blob/2.1.1/dist/jquery.js#L1164

They both check for the support of querySelectorAll, and will use that. You will get similar speed than when using jquery and querySelectorAll in the case it exists (Some performance differences may exist because of the extra function calls). The good thing is that you're sure that it works in older browsers.

like image 196
edi9999 Avatar answered Mar 10 '26 11:03

edi9999