2 ms·
What I'm curious about is, if these are equivalent, why doesn't JQuery just delegate to them in browsers where it is supported? Then you can get both the speed
by jamesaguilar 13y ago
What I'm curious about is, if these are equivalent, why doesn't JQuery just delegate to them in browsers where it is supported? Then you can get both the speed and the compatibility.
- mambodog 13y agoIn the case of querySelectorAll, it does[1] (after performing some checks for easy wins) and if this test[2] is anything to go by, it can actually perform better in some cases. [1] https://github.com/jquery/sizzle/blob/master/sizzle.js#L237 https://github.com/jquery/sizzle/blob/master/sizzle.js#L237 [2] http://jsperf.com/yui3-vs-jquery-selector-test-3/54 http://jsperf.com/yui3-vs-jquery-selector-test-3/54