Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Commit

Permalink
fix: IE8 regression.
Browse files Browse the repository at this point in the history
0.7.1 breaks IE8, this commit takes it back
  • Loading branch information
lwr committed Sep 28, 2017
1 parent fde94d7 commit 9d98ee9
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions addScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,25 @@
Author Tobias Koppers @sokra
*/
module.exports = function(src) {
function log(error) {
(typeof console !== "undefined")
&& (console.error || console.log)("[Script Loader]", error);
}

// Check for IE =< 8
function isIE() {
return typeof attachEvent !== "undefined" && typeof addEventListener === "undefined";
}

try {
if (typeof eval !== "undefined") {
eval.call(null, src);
} else if (typeof execScript !== "undefined") {
if (typeof execScript !== "undefined" && isIE()) {
execScript(src);
} else if (typeof eval !== "undefined") {
eval.call(null, src);
} else {
console.error("[Script Loader] EvalError: No eval function available");
log("EvalError: No eval function available");
}
} catch (error) {
console.error("[Script Loader] ", error.message);
log(error);
}
}

0 comments on commit 9d98ee9

Please sign in to comment.