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

Commit

Permalink
fix: modify script evaluation for IE11 (#41)
Browse files Browse the repository at this point in the history
Closes #39 
Closes #41
  • Loading branch information
emememw authored and joshwiens committed Sep 12, 2017
1 parent 162ab8b commit 370ff3d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions addScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
Author Tobias Koppers @sokra
*/
module.exports = function(src) {
if (typeof execScript !== "undefined")
execScript(src);
else
eval.call(null, src);
try {
if (typeof eval !== "undefined") {
eval.call(null, src);
} else if (typeof execScript !== "undefined") {
execScript(src);
} else {
console.error("[Script Loader] EvalError: No eval function available");
}
} catch (error) {
console.error("[Script Loader] ", error.message);
}
}

3 comments on commit 370ff3d

@lwr
Copy link
Contributor

@lwr lwr commented on 370ff3d Sep 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change breaks IE8

  1. IE8 do not have console.error
  2. eval.call(null, src) does not work for IE8, the eval code is limited to local, not global scope

@alexander-akait
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lwr can you do PR to fix this?

@lwr
Copy link
Contributor

@lwr lwr commented on 370ff3d Sep 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evilebottnawi I'll try it #43

Please sign in to comment.