What Is HTML5 Shiv ?

HTML5Shiv allows versions of Internet Explorer prior to version 9 to recognize the HTML5 tags and allows them to be styled using CSS.

How to Implement HTML5 Shiv ?

Using HTML5 Shiv on an HTML5 web page is simple; you may do so with or without installation of the library. Below is an example of how to conditionally include HTML5 Shiv only for Internet Explorer browsers less-than version 9.

<!DOCTYPE html>
<html>
 <head>
  <!--[if lt IE 9]>
  <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js"></script>
  <![endif]-->
 </head>
 <body>
 </body>
</html>

What do these files do?

html5shiv.js

  • This includes the basic createElement() shiv technique, along with monkeypatches for document.createElement and document.createDocumentFragment for IE6-8. It also applies basic styling for HTML5 elements for IE6-9, Safari 4.x and FF 3.x.

html5shiv-printshiv.js

  • This includes all of the above, as well as a mechanism allowing HTML5 elements to be styled and contain children while being printed in IE 6-8.

HTML5 Shiv Known Issues and Limitations

  • The shivMethods option (overriding document.createElement) and the html5.createElement method create elements, which are not disconnected and have a parentNode
  • The cloneNode problem is currently not addressed by HTML5 Shiv. HTML5 elements can be dynamically created, but can’t be cloned in all cases.
  • The printshiv version of HTML5 Shiv has to alter the print styles and the whole DOM for printing. In case of complex websites and or a lot of print styles this might cause performance and/or styling issues. A possible solution could be the htc-branch of HTML5 Shiv, which uses another technique to implement print styles for Internet Explorer 6-8.

The post HTML5 Shiv appeared first on Coding Players.