Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Bare-Bones HTML5 "Shiv" for IE8 and IE7
var html5Elements = [
'abbr', 'article', 'aside', 'bdi', 'data', 'datalist',
'figcaption', 'figure', 'footer', 'header', 'main', 'mark', 'meter',
'nav', 'output', 'progress', 'section', 'summary', 'time'];
headElement = document.head || document.getElementsByTagName('head')[0],
blockCSS = 'article,aside,figcaption,figure,footer,header,main,nav,section{display: block;}';
insertStyle = document.createElement('style');
for (var i = 0; i < html5Elements.length; i++) {
insertStyle.type = 'text/css';
if (insertStyle.styleSheet){
insertStyle.styleSheet.cssText = blockCSS;
else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment