Fix issue #109 by @importing CSS as data URIs when printing. #114

wants to merge 2 commits into


None yet
1 participant

mkantor commented Oct 17, 2012

In IE9 swap out prefixed CSS for imported data URIs onbeforeprint and restore the regular prefixed CSS onafterprint in order to work around a bug where @media screen styles were being applied to print media.

Some tests are available here. Compare this to the same tests run with a version of -prefix-free without the changes from this pull request (print the pages with IE9 and compare the results).

mkantor added some commits Oct 12, 2012

@mkantor mkantor Fix #109: in IE9 swap CSS out with data URI @imports before printing.
- Add a data-prefixed attribute to keep track of which styles were
  changed by -prefix-free.
- Make sure data URIs use the same charset as the document.
- Update the minified version as well.
@mkantor mkantor Clean up CSS afterprint.
This fixes a few bugs that could occur when there were data URIs
and/or @imports in the original CSS (styles would be borked after
returning to the screen view). It also helps ensure that DOM
inspection is as WTF-less as possible.

A new `data-importeddatauri` attribute is used to keep track of CSS
state and the prefixed "raw" (unimported) CSS is stored in a property
named `beforeBeforePrintTextContent` on the HTMLStyleElement objects

mkantor commented Oct 17, 2012

To get GitHub to do its fancy cross-reference thing: this fixes #109.

mkantor commented Feb 22, 2013

@leaverou I realize you're very busy and that I submitted this pull request ages ago, but is there anything I can do to help get this reviewed? I'd even be satisfied if the answer is "now that IE10 exists forget about this bug".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment