An HTML5 Shim in an HTML Component
Switch branches/tags
Nothing to show
Latest commit a2e814d Aug 5, 2011 @chjj m
Failed to load latest commit information.
LICENSE An HTML5 Shim is an HTML Component and html5 "shim" to fix bugged HTML5 elements in IE.

UPDATE: It is better to put the behavior property on the body element as opposed to the html element.

Technically speaking, it's not actually a shim: The traditional html5 shim works by using document.createElement to essentially fix IE's HTML parser. This .htc file is different in that it will go in after the fact and fix the DOM structure by hand. This is the only way to do it because .htc's can only be executed after the document has loaded. It's not as elegant, no, but you don't have to muddy up your markup. It's a little hacksy, but this is all it requires:

body { behavior: url(; }

Obviously, all non-IE browsers will completely ignore that property.

It arguably saves more bandwidth in the long run because a .css and .htc file can be cached, whereas conditional comments will linger on every response served. It also seems much better looking than the ugly looking conditional comments which only pollute your markup.


(c) Copyright 2011 (MIT Licensed), Christopher Jeffrey.
See LICENSE for more info.