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

feat: Add async to body scripts (update: Use defer instead) #5704

Merged
merged 5 commits into from
May 22, 2017

Conversation

atinux
Copy link
Contributor

@atinux atinux commented May 19, 2017

What kind of change does this PR introduce? (check at least one)

  • Feature

Does this PR introduce a breaking change? (check one)

  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

async tag let the scripts to not block the render of the page, and since it's for SSR, the scripts don't have to be loaded before the first render.

@blake-newman
Copy link
Member

Looks good although I can't find any specification on the behaviour of multiple async script tags. Does it keep the linear order or will it execute as soon as script is parsed.

If the latter then there could be race conditions. This may be worth an investigation.

@atinux
Copy link
Contributor Author

atinux commented May 21, 2017

Based on this answer: http://stackoverflow.com/questions/8996852/load-and-execute-order-of-scripts

It may be better to use defer instead of async to keep the order, what do you think?

@blake-newman
Copy link
Member

Good find :)

Yeah defer is the best, as it will keep predicability.

@atinux
Copy link
Contributor Author

atinux commented May 21, 2017

Commits updated 👍

@atinux atinux changed the title feat: Add async to body scripts feat: Add async to body scripts (update: Use defer instead) May 21, 2017
@yyx990803 yyx990803 merged commit f3757eb into vuejs:dev May 22, 2017
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

Successfully merging this pull request may close these issues.

3 participants