Archive for October 19th, 2007

Please note: the CSS parser is complete and documented in this post
I had an idea to write a CSS parser to allow custom jQuery attributes, since a lot of the jQuery I use is more presentation than behavior, and the redesign of the YI website allows for switching stylesheets, which may require different plugins to be applied. My idea would be to allow something like:

div {
-jquery-round: 5;
-jquery-gradient: {from: '#008800', to: '#000088'}
}

But I never did anything about until Andy Kent developed JSS which does something similar for CSS selectors that a browser can’t handle but that jQuery can. His code also includes a cache for selectors that implements partial selector caching (thus div span img would also search the cache for div and div span as well). I emailed him back and forth a few times, and made some suggestions; my best css parser and selector cache are available here (look at the code and use Firebug to look at the console). I still haven’t got the custom jQuery stuff together yet, but the pieces may be useful right now.
Please note: the CSS parser is complete and documented in this post