Friday, January 12th, 2007
DomQuery - A lightweight CSS Selector / Basic XPath implementation
Jack Slocum is a machine. We had to add the new YUI-EXT category for him as he is coming up with such good material.
His latest, is an article on DomQuery - A lightweight CSS Selector / Basic XPath implementation.
Support for more complex schemas and document structures in the grid’s XMLDataModel class has been requested many times. Currently, you are limited to a schema which consists of only element level tag names and attributes. That is where DomQuery started. When loading a grid from an XML Document, there would be quite a few rapidly executing queries so great performance was imperative. Thanks to the FireBug Profiler, I was able to trace the bottlenecks and test different execution plans to see what was the fastest.
This library is nice and speedy. According to John Resig it is faster than Dean Edwards cssQuery. John wrote about this in response to the benchmark figures of jQuery that Jack shows:
We’ve been holding off on talking about the speed of the jQuery selectors for the new 1.1 release until our release was closer to being ready - however, it seems as if that process has already been expedited. So with that already out of the bag, lets look at the selector speeds of jQuery.
In short: For jQuery 1.1 we worked really really hard to make its selectors really fast. In fact, according to all our tests we were faster than any other selector library. Working on the 1.1 release, Dean Edwards’ cssQuery far out-performed any other selector library. It’s really comprehensive, and really fast.
Today, Jack Slocum announced his new DOMQuery selector library. In short: The bar has been raised. His library is very very fast. Quite possibly the fastest available today.
However, in the comparison between his library and ours, some mistakes were made that we’d like to clear up. (By both Jack and jQuery) (For reference, here’s the comparision suite that I used for my tests.)













In case anyone is interested, I did post a response to John’s post here:
http://www.jackslocum.com/blog/2007/01/12/domquery-in-response-to-jquerys-response/
Yep and John acknowledged your response and fixes accordingly in a comment on your blog and also by updating his posting. Great work on DomQuery, Jack.
Rey…
Some of those selectors are not valid CSS or XPath. It is a bit harsh to say that other libraries return “invalid” results for these tests. None of the following selectors are valid:
#test-data span:first
#test-data span:last
#test-data span[title!=east]
#test-data/pre/code/span
#test-data/pre[class=highlighted]/code
Okey, nice shot, but try at least to support Safari. DomQuery fails completely at my new MacBook.
> but try at least to support Safari
Safari is always supported. I made quite a few changes in response to the jQuery post and one of the changes broke Safari. It has been fixed.
Keep it up guys,
We’ve been monitoring the progress of Jack Slocum YUI-Ext library for quite sometime now. Honestly, in terms of features YUI-Ext exceed any other libraries out there. Unfortunately, the simplicity of the library for beginner/intermediate users still need to be improved. I would definitely use the combination of both jQuery and YUI-Ext for our application development in the future, unless if YUI-Ext can offer something like jQuery. I’m still thinking that that it’s better for YUI-Ext to be built on top of jQuery, instead of YUI, right?
man or machine …