f563940f69
### Summary Fixes #52935 `next/script` has a `Script` component that supports an `async` prop. However, when scripts are loaded with the `async` prop set to false, the script is loaded as if async was set to true. This may cause scripts to execute out of order. Repro: https://github.com/domdomegg/next-async-script-reproduction I think this is occurring because Next uses setAttribute to set the async and defer attributes. However, this is not a valid way to set these properties on a script. This is because . Demo: https://jsfiddle.net/6ktpfae1/ This PR fixes this behaviour by using removeAttribute after calling setAttribute (rather than using setAttribute "false"). This appears to result in correct behaviour. Given it appears this workaround was already applied in `next/head`, I've harmonised the code between these two. ### Next steps I think this PR is ready for review. I acknowledge there are no test changes, but there are no existing tests for `next/script` at all and creating them I think would be disproportionally difficult given issues in #52943. --------- Co-authored-by: Tim Neutkens <tim@timneutkens.nl> Co-authored-by: Sam Ko <sam@vercel.com> Co-authored-by: JJ Kasper <jj@jjsweb.site> |
||
---|---|---|
.. | ||
client-navigation | ||
custom-app-hmr |