Skip to content

Commit

Permalink
Fix printing error in IE9 by putting the print media check before att…
Browse files Browse the repository at this point in the history
…empting to access window.PIE
  • Loading branch information
lojjic committed Feb 9, 2012
1 parent 0c0087f commit c080e1b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions sources/htc_script.js
Expand Up @@ -72,16 +72,20 @@ if ( !window[ 'PIE' ] && docMode < 10 ) {
}

function init() {
var PIE = window[ 'PIE' ];
if( PIE && doc.media !== 'print' ) { // IE strangely attaches a second copy of the behavior to elements when printing
PIE[ 'attach' ]( el );
if ( doc.media !== 'print' ) { // IE strangely attaches a second copy of the behavior to elements when printing
var PIE = window[ 'PIE' ];
if( PIE ) {
PIE[ 'attach' ]( el );
}
}
}

function cleanup() {
var PIE = window[ 'PIE' ];
if ( PIE && doc.media !== 'print' ) {
PIE[ 'detach' ]( el );
if ( doc.media !== 'print' ) {
var PIE = window[ 'PIE' ];
if ( PIE ) {
PIE[ 'detach' ]( el );
}
}
el = 0;
}
Expand Down

0 comments on commit c080e1b

Please sign in to comment.