aFarkas / html5shiv

This script is the defacto way to enable use of HTML5 sectioning elements in legacy Internet Explorer.
http://paulirish.com/2011/the-history-of-the-html5-shiv/
9.89k stars 2.56k forks source link

Support for IE9 printing #128

Open anders72 opened 11 years ago

anders72 commented 11 years ago

Hi!

We have a problem with IE9 and printing. We are using HTML 5 elements in our code that we would like to hide when printing:

HTML:

<link rel="stylesheet" type="text/css" media="print" href="print.css"/>
<script src="html5shiv-printshiv.js"></script>
....
<nav>
<ul>
    <li>Should not be printed</li>
</ul>
</nav>

print.css

nav { display :none }

This works great when using IE8 and the printshiv resulting in the nav tags being hidden. But when I print using IE9 the nav tags are displayed.

Your documentation says that the printshiv only supports IE8, is there any reason why you won't support IE 9?

I tried to hack printshiv by replacing:

var supportsShivableSheets = !supportsUnknownElements && (function() ...

with: var supportsShivableSheets = (function() ...

This seemed to fix the printing problem, but I don't know if this will have any side effects?