For Microsoft Internet Explorer 5 and later, HTML Components (HTCs) provide a mechanism to implement components in script as Dynamic HTML (DHTML) behaviors. An HTC is an HTML file that contains script and a set of HTC-specific elements that define the component. The component is saved with an .htc extension. This section lists these HTC-specific elements and the members they support.
HTC Reference
How did I not know about these before? Essentially, they let you inject new behaviors into IE. this guy injected :hover onto any class, something that IE 6 and lower don’t support. This guy fixed PNG 24-bit transparency.
Essentially, you include a link to an HTC file (a file ending in .htc or .hta) into your document. Using a JavaScript-based syntax, you can essentially hack through the old IE DOM (or stylesheets, or whatever) and rewrite it to workaround IE limitations.
In the :hover example above, the author parses all the stylesheets and creates a class-based JavaScript workaround. Yep, that’s what you’d usually do to implement :hover, only this is done all behind the scenes: you define your stylesheet as normal, and the HTML Component takes over and extends IE’s behavior to match it.
Couple these with conditional comments, and you can selectively extend versions of Internet Explorer with behaviors they don’t (and should) support.
Like conditional compilation, how did I not know about this by now?
Tags: ie, ie6, ie7, crossbrowser, ie6hover, htc, htmlcomponents