summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/astro/components/ViewTransitions.astro15
-rw-r--r--packages/astro/e2e/view-transitions.test.js6
2 files changed, 12 insertions, 9 deletions
diff --git a/packages/astro/components/ViewTransitions.astro b/packages/astro/components/ViewTransitions.astro
index ad5a9b0f6..d7703bc82 100644
--- a/packages/astro/components/ViewTransitions.astro
+++ b/packages/astro/components/ViewTransitions.astro
@@ -48,12 +48,15 @@ const { fallback = 'animate' } = Astro.props as Props;
const swap = () => document.documentElement.replaceWith(doc.documentElement);
// Wait on links to finish, to prevent FOUC
- const links = Array.from(doc.querySelectorAll('head link[rel=stylesheet]')).map(link => new Promise(resolve => {
- const c = link.cloneNode();
- ['load', 'error'].forEach(evName => c.addEventListener(evName, resolve));
- document.head.append(c);
- }));
- if(links.length) {
+ const links = Array.from(doc.querySelectorAll('head link[rel=stylesheet]')).map(
+ (link) =>
+ new Promise((resolve) => {
+ const c = link.cloneNode();
+ ['load', 'error'].forEach((evName) => c.addEventListener(evName, resolve));
+ document.head.append(c);
+ })
+ );
+ if (links.length) {
await Promise.all(links);
}
diff --git a/packages/astro/e2e/view-transitions.test.js b/packages/astro/e2e/view-transitions.test.js
index f73b26675..da5252709 100644
--- a/packages/astro/e2e/view-transitions.test.js
+++ b/packages/astro/e2e/view-transitions.test.js
@@ -128,9 +128,9 @@ test.describe('View Transitions', () => {
});
test('Stylesheets in the head are waited on', async ({ page, astro }) => {
- page.addListener('console', data => {
- console.log(data)
- })
+ page.addListener('console', (data) => {
+ console.log(data);
+ });
// Go to page 1
await page.goto(astro.resolveUrl('/one'));