Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chjj/shim.htc
An HTML5 Shim in an HTML Component
https://github.com/chjj/shim.htc
Last synced: 16 days ago
JSON representation
An HTML5 Shim in an HTML Component
- Host: GitHub
- URL: https://github.com/chjj/shim.htc
- Owner: chjj
- License: mit
- Created: 2011-04-06T04:38:52.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-08-05T00:39:24.000Z (over 13 years ago)
- Last Synced: 2024-10-20T01:14:52.615Z (24 days ago)
- Language: JavaScript
- Homepage:
- Size: 95.7 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# shim.htc: An HTML5 Shim
__shim.htc__ is an [HTML Component](http://en.wikipedia.org/wiki/HTML_Components) 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:``` css
body { behavior: url(shim.htc); }
```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.## License
(c) Copyright 2011 (MIT Licensed), Christopher Jeffrey.
See LICENSE for more info.