Permalink
Browse files

Check that p (which is window['PIE']) exists.

Some other scripts might remove window['PIE'] mid-function-call, which would be bad and generates 'Object does not support this property or method' errors.
Should resolve issue 89.
  • Loading branch information...
ziggythehamster committed Dec 13, 2010
1 parent c9a03fc commit fe693aedf88569fba13ac0d7fb95ee763b714a1d
Showing with 5 additions and 3 deletions.
  1. +5 −3 sources/htc_init.js
View
@@ -2,14 +2,16 @@ var p = window['PIE'],
el = element;
function init() {
- if( doc.media !== 'print' ) { // IE strangely attaches a second copy of the behavior to elements when printing
+ if( p && doc.media !== 'print' ) { // IE strangely attaches a second copy of the behavior to elements when printing
p['attach']( el );
}
}
function cleanup() {
- p['detach']( el );
- p = el = 0;
+ if (p) {
+ p['detach']( el );
+ p = el = 0;
+ }
}
if( el.readyState === 'complete' ) {

0 comments on commit fe693ae

Please sign in to comment.