Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Check that p (which is window['PIE']) exists.
Browse files Browse the repository at this point in the history
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 fe693ae
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sources/htc_init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) {
Expand Down

0 comments on commit fe693ae

Please sign in to comment.