Skip to content
bkardell edited this page May 14, 2012 · 15 revisions

FAQ

What is Hitch?

Hitch is a lightweight JavaScript engine (about 5.5k minified/gzipped) that allows definition and use of new CSS selectors.

Rules using these selectors are hashed and managed by the engine (live) which simply attaches and detaches vanilla CSS classes (the rule's hash) as they gain or lose relevance, thereby allowing a common usage pattern which provides authors greater expressive abilities and helps keep presentation related rules in CSS.

Are there any known limitations?

Why, yes there are. What a great question!

Err... What are they?

We're not telling... If you find one submit it as a bug.

That's not funny.

We disagree.. It is a little funny.

Seriously: what are the limitations.

Ok, ok... The parser is currently not perfect. It doesn't follow @imports and it might puke on some obscure cases we haven't yet considered. Currently it only runs on "modern" browsers.

Isn't that limiting?

Maybe.

Do you plan to correct that?

In all likelihood no. We have less than 0 interest in trying to make this work in IE6. I have IE7 and 70% of websites I visit have clear errors. The uptake on IE8 has already exceeded IE7. IE9 is going strong and IE10 is actually looking like it might be a pretty decent browser. So what's the point? IE8+, probably. Choose to use it or don't. You don't need to wait for FF 27 or Chome 32 or IE 52... that's the point.

Any limitations/things to know about speed? How fast is it?

The engine used at runtime is pretty quick... we've tested it with some fairly big trees and it performs really well... But look - it's still running a part of the evaluation as script, so please don't add 1,000 really complex filters and 1,000 uses of those filters which are all based on * and throw it on your crazy page with 100,000 elements and then say "it's really slow". If you have a few dozen rules based on decent selectors (a few * are ok) that employ semi-efficient hitches and your page is within even a few times as big as "average" it will be 'beyond human comprehension' kind of fast - and isn't that what really matters? We recommend that you keep a separate sheet for your hitch-based rules and keep them reasonably sane.

Can I add new tokens for use in selectors? For example, I would like to say something like "div < .x".

No. Not now, not ever. Forget it. We are uninterested in breaking the forward compatibility rules in CSS... We agree with them and we think they are sane.

Can I add new modules?

No, not now at least...

Why not?

Modules in CSS are (currently at least) all about rendering pretty specific kinds of things and they involve very specific cascade and calculation semantics which make them considerably more difficult to extend in this manner.

So I never will be able to?

Never say never. There might be some possibilities... If you have some suggestions or ideas, send them our way.

Can I add new types/functions?

No, not now at least - for most of the same reasons as above. In all likelihood this would be even more difficult to add with the current APIs available to us. Hopefully changes in CSSOM will make this things more plausible... It seems as if this would be an ideal extension point, however, it's not nearly as difficult add a mechanism for that from the browser's perspective as it is from outside the browser. Again, if you have some ideas - we're all ears.

Clone this wiki locally