hitchjs
Re:Content Based CSS
on Friday May 11, 2012 @05:59PM (#3961656)
For posterity, viewing a few more examples may be the best way to help differentiate and understand their different purposes:
http://hitchjs.wordpress.com/2012/05/11/content-based-css-ma...
Re:Content Based CSS
on Thursday May 10, 2012 @10:40AM (#3953730)
We'll have to write up an article about how it works. I'm sure we'll be iterating on the source quite a lot now that we have a nice working set of things...
Essentially though, we look at the modification to narrow down the potentially matching rules, then we use querySelectorAll/matchingfns at the appropriate spot in the tree. Each selector (like :-hitch-has) then has a filter function which merely returns true/false (just like jquery) and based on that we toggle an associated class on the element and the rest is just the browser's native CSS doing what it does.