Return to Snippet

Revision: 27621
at June 18, 2010 00:43 by mennyj


Initial Code
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,header,mark,menu,meter,nav,output,progress,section,time,video".split(','),i=e.length;while (i--){document.createElement(e[i])}})()

Initial URL
http://remysharp.com/2009/01/07/html5-enabling-script/

Initial Description
[via rtcrm]

Since HTML5 is getting [more](http://www.brucelawson.co.uk/tests/html5-elements.html) [attention](http://adactio.com/journal/1540/) by way of marking up our new pages, and the only way to get IE to acknowledge the new elements, such as `<article>`, is to use the [HTML5 shiv](http://ejohn.org/blog/html5-shiv/), here’s a mini script that enables all the new elements.

###Usage & Download###

The html5.js and must be inserted in the head element _(this is because IE needs to know about the element before it comes to render them — so it can’t sit in the footer of the page, i.e. below the elements in question)_.

It’s conditional within the code, so Firefox _et al_ won’t run the code — but it doesn’t hurt to wrap it in an IE conditional call to reduce the http pulls for other browsers:

<pre><code>&lt;!--[if IE]&gt;
&lt;script src="html5.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;![endif]--&gt;
</code></pre>

Initial Title
HTML5 Enabling Script

Initial Tags
js, html5

Initial Language
JavaScript