Friday, January 12th, 2007

DomQuery – A lightweight CSS Selector / Basic XPath implementation

Category: CSS, JavaScript, jQuery, Performance, Sencha

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.)

Posted by Dion Almaer at 8:10 am
7 Comments

++++-
4.1 rating from 50 votes

7 Comments »

Comments feed TrackBack URI

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/

Comment by Jack Slocum — January 12, 2007

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…

Comment by Rey Bango — January 12, 2007

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

Comment by Dean Edwards — January 12, 2007

Okey, nice shot, but try at least to support Safari. DomQuery fails completely at my new MacBook.

Comment by Jorgen Horstink — January 13, 2007

> 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.

Comment by Jack Slocum — January 13, 2007

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?

Comment by Wendy Novianto — January 15, 2007

man or machine …

Comment by zee — February 20, 2007

Leave a comment

You must be logged in to post a comment.