Harald Kirschner’s Sly
Back in December when the Sizzle selector engine was announced, John Resig's creation was thought to be the end game. Four months later it seems as though it was just the beginning.
Harald Kirschner has released Sly, a standalone JavaScript selector engine that absolutely tears through the DOM. Sly is a tiny 3KB minified and gzipped, supports all CSS3 selectors, and provides functionality to create your own custom combinators. Don't believe me? Read Harald's documentation.
Support
- Sly's Slickspeed (note that Sizzle is represented as jQuery 1.3.2)
- Sly Download Page
- Clientcide Review
Usage Examples
// Finds all div blocks blocks = Sly.search('div'); // Finds all anchors with `href` attribute that starts with `"http://"` anchors = Sly.search('a[href^="http://"]'); // Finds all list item that are direct descendants of the list item with id `"navigation"` items = Sly.search('ul#navigation > li'); // Finds all heading elements heads = Sly.search('h1, h2, h3, h4, h5, h6'); // Finds all odd rows in all tables with the class `"zebra"` rows = Sly.search('table.zebra tr:odd'); // Finds something and looks really complex inputs = Sly.search('form[action$=/send/] label~span+input[type=text]:first-child');
That last one was something special, eh?
Congratulations!
Join me in extending a huge congratulations and thank you to Harald! While Sizzle got the ball rolling, the selector engine game isn't over by any means!
Sly is awesome. I’ve been messing around with it lately. It’s fast as hell.
Interesting! By the way, on your site, simple key shortcuts such as pressing space or arrows to scroll, or Page Up/Down, doesn’t always work. I tested some different scenarios, and when entering something to a comment input and then again clicking outside the input, it suddenly works… Weird behaviour. I’m using Firefox 3.0.7.
I read about this first on clientcide, but definitely very exciting to see someone with some strong mootools ties putting out a selector engine. I don’t have anything against jquery, but I’ve been a hardcore mootools fan for some time now, and I suppose its that passive nature mootools and the mootools community have in regards to advertising that I enjoy. Its a framework built in a way that makes sense, and it doesn’t need phony gimmicks and underhanded approaches to attract the audience it wants. I was pretty inspired with how much more intelligent the responses were from the community when Sizzle advocates were trying to weasel the engine into every framework core.
I haven’t gotten a chance to use Sly yet, but I’m looking forward to the first opportunity.