Merge pull request #13271 from kuschti/patch-1

Core: Fix template script tag support
This commit is contained in:
Michael Shilman 2020-11-27 21:58:43 +08:00 committed by GitHub
commit 31f287f22d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,15 +82,17 @@ export function simulatePageLoad($container: any) {
const typeAttr = $script.getAttribute('type');
// only run script tags without the type attribute
// or with a javascript mime attribute value
if (!typeAttr || !runScriptTypes.includes(typeAttr)) {
// or with a javascript mime attribute value from the list
if (!typeAttr || runScriptTypes.includes(typeAttr)) {
scriptsToExecute.push((callback: any) => insertScript($script, callback, $scriptsRoot));
}
});
// insert the script tags sequentially
// to preserve execution order
insertScriptsSequentially(scriptsToExecute, simulateDOMContentLoaded, undefined);
if (scriptsToExecute.length) {
insertScriptsSequentially(scriptsToExecute, simulateDOMContentLoaded, undefined);
}
} else {
simulateDOMContentLoaded();
}