diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts index b4b8b879d00c..2be12895e53f 100644 --- a/packages/astro/src/transitions/router.ts +++ b/packages/astro/src/transitions/router.ts @@ -134,7 +134,7 @@ export function getFallback(): Fallback { function runScripts() { let wait = Promise.resolve(); - for (const script of document.scripts) { + for (const script of document.getElementsByTagName('script')) { if (script.dataset.astroExec === '') continue; const type = script.getAttribute('type'); if (type && type !== 'module' && type !== 'text/javascript') continue; @@ -643,7 +643,7 @@ if (inBrowser) { ); } } - for (const script of document.scripts) { + for (const script of document.getElementsByTagName('script')) { script.dataset.astroExec = ''; } }