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

Core: Fixed race condition caused by deferring the script #2103

Merged
merged 2 commits into from
Oct 25, 2019

Conversation

RunDevelopment
Copy link
Member

As discussed in #2102.

I'll make a different PR for the currentScript issue.

@RunDevelopment
Copy link
Member Author

You can verify that this indeed fixes the race condition by replacing prism.min.js in the test page by @BrainStone with <script defer src="http://localhost/prism.js"></script> (localhost being this PR).

You'll see that the race condition is no more.

@mAAdhaTTah
Copy link
Member

Def going to want a code comment in there explaining a bit of why this is necessary.

@RunDevelopment
Copy link
Member Author

Comment as requested.
I also added readyState === 'interactive' to the condition because if the readyState === 'complete' then the script can be deferred all it wants, DOMContentLoaded has already been fired.

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

Successfully merging this pull request may close these issues.

2 participants