Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script loading/eval not working for IE8 #30

Open
brtubb opened this issue Sep 8, 2015 · 1 comment
Open

Script loading/eval not working for IE8 #30

brtubb opened this issue Sep 8, 2015 · 1 comment

Comments

@brtubb
Copy link

brtubb commented Sep 8, 2015

It appears the script parsing of templates fails quietly in IE8. The end result is a silent failure that doesn't get emit from ractive-load in any fashion, and puts the Promise in a metastable state (never triggers fail/success criteria).

The core issue is in eval2.Function(). The code is wrapping the component's <script> with an anonymous function to achieve scope isolation. The bug manifests itself here in IE8: this older version of IE doesn't eval anonymous functions properly, returning "undefined" instead of the desired effect. There's a little more information in this SO thread: http://stackoverflow.com/q/1271516

The "solution" I'm using is further down in the answers: http://stackoverflow.com/a/8115692
Appears to be working well for me and hasn't caused other deleterious effects (yet). I'm happy to submit a PR if this looks like a reasonable fix.

var jsString = "(function(arg1) { alert('Hello World!'); })";

/*
 * IE8/9 Fails in current code
 */
eval(jsString); 
// undefined

/*
 * Suggested Solution
 */
eval("false||" + jsString);
// (function(arg1)...
@avoto
Copy link

avoto commented Jan 4, 2016

Brian, do you mind sharing what you've done exactly to resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants