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

Commit 16dd0b1

Browse files
committed
fix: IE8 regression.
0.7.1 breaks IE8, this commit takes it back
1 parent fde94d7 commit 16dd0b1

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

addScript.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,21 @@
44
*/
55
module.exports = function(src) {
66
try {
7-
if (typeof eval !== "undefined") {
8-
eval.call(null, src);
9-
} else if (typeof execScript !== "undefined") {
7+
if (typeof execScript !== "undefined"
8+
/* "bad" IE */ && typeof attachEvent !== "undefined" && typeof addEventListener === "undefined") {
109
execScript(src);
10+
} else if (typeof eval !== "undefined") {
11+
eval.call(null, src);
1112
} else {
12-
console.error("[Script Loader] EvalError: No eval function available");
13+
report("EvalError: No eval function available");
1314
}
1415
} catch (error) {
15-
console.error("[Script Loader] ", error.message);
16+
report(error);
17+
}
18+
19+
function report(error) {
20+
(typeof console !== "undefined")
21+
&& (console.error || console.log)("[Script Loader]", error);
1622
}
23+
1724
}

0 commit comments

Comments
 (0)