Permalink
Browse files

Fix printing error in IE9 by putting the print media check before att…

…empting to access window.PIE
  • Loading branch information...
1 parent 0c0087f commit c080e1b830741432ae397f6098470b132a76a6af @lojjic committed Feb 9, 2012
Showing with 10 additions and 6 deletions.
  1. +10 −6 sources/htc_script.js
View
@@ -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;
}

0 comments on commit c080e1b

Please sign in to comment.