-
Notifications
You must be signed in to change notification settings - Fork 79
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
HTML script tags are async by default #103
Comments
This might explain why I've (recently) noticed that sometimes dependencies (e.g. Mithril) aren't loaded before the page code executes. |
I've also experienced this problem lately. |
I've experienced this "timing" issues, too. Quite often in fact. |
Nice debugging @pmarchezz ! I'll see if I can get that fixed today 👍 |
Fix also pushed to flems.io 🙂 |
Does this also affect possible issues when integrating Flems like described here? https://github.com/porsager/flems#getting-started I had similar "timing" issues that randomly occured. |
Yeah, if you upgrade to latest that should solve your issues 😊 |
Hi, I'm using Flems for some code examples on a project's documentation. Recently my examples broke, apparently because some script tags added in HTML don't appear to be blocking anymore (the second one executes when the first one is still loading). For example:
This logs a function in both a test webpage and on editors like jsfiddle or similar. However on Flems it logs undefined (I actually got the expected result once or twice, I assume it's not 100% consistent since it looks like a race condition).
(I'm not saying that this is a reasonable way to use jquery, it's just to provide a minimal case where the issue is reproduced)
I think this is caused by commit
7620dcb4d7c2784a4929d04053b4d0d205044a96
and in particular by this change:This means the
async
attribute is not added to the generated script tag anymore when it'sfalse
and, since (if I'm not mistaken) all script tags created via js are async by default, it causes script tags to load/execute out of order (which causes the above behaviour). I tried building my own version of Flems with this slight change(key === 'async' || options[key]) && (el[key] = options[key])
and it fixes the issue.Can you take a look to validate if that's an issue or not? If more info are needed feel free to ask. Thanks!
The text was updated successfully, but these errors were encountered: