i am dustin diaz

a JavaScriptr...

boosh.

don't worry about it.

Qwery - The Tiny Selector Engine

It's true. The world needs another JavaScript DOM Selector Engine. So without further fuss - introducing Qwery - The Tiny Selector Engine. It's a port from where Simon Willison left off with his getElementsBySelector in 2003, and believe it or not, this is exactly where jQuery started.

Qwery supports all the basic CSS1 & CSS2 selectors, plus the additional (most important) attribute selectors from CSS3. Additionally it allows multi-selects (div,p) as well as context-aware selectors (like jQuery.find()).

Last but not least, it's open source awaiting your valuable feedback to make it leaner and faster. There are tests to ensure its integrity, however sans-benchmarks. Although, it should be noted it does support querySelectorAll when available in the browser (to bring 2003 to modern times).

Why all this?

When it comes right down to it, you often don't need a full blown selector engine suite. Qwery is 1k (gzip+min) which comes out to 1/4 the size the Sizzle. And on a day to day development basis, it's pretty rare to be seeking an obscure element collection from a query like div > p:lang:(en):nth-child(1n+0):not([data^="user-"]) . Seriously, who does that? (Maybe 2% of you are raising your hand).

Real world css queries

To put things into perspective, building #NewTwitter didn't require a single complicated CSS query beyond attribute selectors to retrieve data on nodes (which Qwery supports). Other than that, most queries were simple element/class descendent selectors. That being said, given the complexity of the application it's safe to say most applications will never need anything beyond what Qwery provides. So have at it and give it a play

Contributors

Cheers.

this is who i am

Hi, my name is Dustin Diaz and I'm an Engineer @ObviousCorp. Previously @Twitter, @Google, and @Yahoo, author of Strobist® Info co-author of JavaScript Design Patterns, co-creator of the Ender JavaScript Framework, a Photographer, and an amateur Mixologist. This is my website. Welcome!

On this site I write about JavaScript. You can also follow along with my open-source work on Github.

This site is optimized and works best in Microsoft Internet Explorer 6.