diff options
author | 2023-08-15 22:26:37 +0200 | |
---|---|---|
committer | 2023-08-15 16:26:37 -0400 | |
commit | 56e7c5177bd61b404978dc9b82e2d34d76a4b2f9 (patch) | |
tree | 269035a3d1d6ed8e618a6ed56d5cc884815b9f21 | |
parent | 76a2ba270d04fa178e2c671c9bfef4ff787fdb7b (diff) | |
download | astro-56e7c5177bd61b404978dc9b82e2d34d76a4b2f9.tar.gz astro-56e7c5177bd61b404978dc9b82e2d34d76a4b2f9.tar.zst astro-56e7c5177bd61b404978dc9b82e2d34d76a4b2f9.zip |
Handle noscript tags in head during ViewTransitions (#8091)
-rw-r--r-- | .changeset/shaggy-cameras-hide.md | 5 | ||||
-rw-r--r-- | packages/astro/components/ViewTransitions.astro | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/.changeset/shaggy-cameras-hide.md b/.changeset/shaggy-cameras-hide.md new file mode 100644 index 000000000..7ae940935 --- /dev/null +++ b/.changeset/shaggy-cameras-hide.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Handle `<noscript>` tags in `<head>` during ViewTransitions diff --git a/packages/astro/components/ViewTransitions.astro b/packages/astro/components/ViewTransitions.astro index 05fc57aa6..28a17a09d 100644 --- a/packages/astro/components/ViewTransitions.astro +++ b/packages/astro/components/ViewTransitions.astro @@ -125,6 +125,10 @@ const { fallback = 'animate' } = Astro.props as Props; }; const swap = () => { + // noscript tags inside head element are not honored on swap (#7969). + // Remove them before swapping. + doc.querySelectorAll('head noscript').forEach((el) => el.remove()); + // Swap head for (const el of Array.from(document.head.children)) { const newEl = persistedHeadElement(el); |