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

Commit e339578

Browse files
committed
fixup! fix: IE8 regression.
minor changes
1 parent 16dd0b1 commit e339578

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

addScript.js

+14-9
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,27 @@
33
Author Tobias Koppers @sokra
44
*/
55
module.exports = function(src) {
6+
7+
function log(error) {
8+
(typeof console !== "undefined")
9+
&& (console.error || console.log)("[Script Loader]", error);
10+
}
11+
12+
// Check for IE =< 8
13+
function isIE() {
14+
return typeof attachEvent !== "undefined" && typeof addEventListener === "undefined";
15+
}
16+
617
try {
7-
if (typeof execScript !== "undefined"
8-
/* "bad" IE */ && typeof attachEvent !== "undefined" && typeof addEventListener === "undefined") {
18+
if (typeof execScript !== "undefined" && isIE()) {
919
execScript(src);
1020
} else if (typeof eval !== "undefined") {
1121
eval.call(null, src);
1222
} else {
13-
report("EvalError: No eval function available");
23+
log("EvalError: No eval function available");
1424
}
1525
} catch (error) {
16-
report(error);
17-
}
18-
19-
function report(error) {
20-
(typeof console !== "undefined")
21-
&& (console.error || console.log)("[Script Loader]", error);
26+
log(error);
2227
}
2328

2429
}

0 commit comments

Comments
 (0)