querySelectorAll and getElementsByClassName
Are there plans to use native browser .querySelectorAll()
and .getElementsByClassName() in future releases?
.getElementsByClassName() works just as described and will be in
upcoming WebKit and Mozilla releases (it's in FF3, which should come
out this quarter). I haven't looked at any Firefox benchmarks, but the
native Webkit implementation is blazing fast:
http://webkit.org/blog/153/webkit-gets-native-getelementsbyclassname/
.querySelectorAll() is much more exciting; it's in the W3C selectors
API
http://www.w3.org/TR/selectors-api/
and already has made it into the nightly Webkit builds (don't know if/
when it will hit Mozilla). It essentially duplicates most of the
functionallity offered by $(selector). See:
http://webkit.org/blog/156/queryselector-and-queryselectorall/
Benchmarks from this are absolutely jawdropping. I know the feelings
you guys have about the mootools slickspeed test, but check out the
Webkit version linked from the above blog post. Setting aside any
pissing matches with other libraries, my tests here have jQuery at
19821ms and native at 863ms!
When might we see these two intelligently swapped in when available to
give modern browsers lightning-fast speed?