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