querySelectorAll in WebKit/Safari
February 15th, 2008 by Robert NymanRecently, David Smith wrote about querySelectorAll support in upcoming version of WebKit (the rendering engine for Safari, amongst others).
Basically, querySelectorAll is a way to get the document to evaluate a CSS selector, and then return the matching node(s). Having native support for this is no less than fantastic!
Example code can look like this:
document.querySelectorAll(".mandatory");
document.querySelectorAll("#container input[type=text]");
I’ve done some coding and performance tests, and it even surpasses cleverly crafted XPath selections. My take is that every web browser implementer should implement this. Now!
Hold off on Firefox 3 and Opera 9.5, this feature is to good to wait longer for. ![]()