Skip to content

Instantly share code, notes, and snippets.

@miketaylr
Created February 6, 2010 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miketaylr/296521 to your computer and use it in GitHub Desktop.
Save miketaylr/296521 to your computer and use it in GitHub Desktop.
// original (http://html5shiv.googlecode.com/svn/trunk/html5.js)
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,figure,figcaption,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})()
// kangax version (29 characters less, yay!)
/*@cc_on(function(e,i){i=e.length;while(i--)document.createElement(e[i])})("abbr,article,aside,audio,canvas,datalist,details,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','))@*/
// @pornelski version (40 characters less than kangax, yay!)
// test @ http://dl.dropbox.com/u/513327/html5_ie_shim.html
/*@cc_on'AbbrArticleAsideAudioCanvasDatalistDetailsEventsourceFigureFooterHeaderHgroupMarkMenuMeterNavOutputProgressSectionTimeVideo'.replace(/.[a-z]+/g,function(n){document.createElement(n)})@*/
// @miketaylr ripped out the outdated elements (datagrid, evenoutsource) from @pornelski's version
// 19 chars lighter.
// note, however, there's still no ruby, rp, rt, summary, or figcaption elements. so everyone loses. :P
/*@cc_on'AbbrArticleAsideAudioCanvasDetailsFigureFooterHeaderHgroupMarkMenuMeterNavOutputProgressSectionTimeVideo'.replace(/.[a-z]+/g,function(n){document.createElement(n)})@*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment