summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Martin Trapp <94928215+martrapp@users.noreply.github.com> 2023-08-15 22:26:37 +0200
committerGravatar GitHub <noreply@github.com> 2023-08-15 16:26:37 -0400
commit56e7c5177bd61b404978dc9b82e2d34d76a4b2f9 (patch)
tree269035a3d1d6ed8e618a6ed56d5cc884815b9f21
parent76a2ba270d04fa178e2c671c9bfef4ff787fdb7b (diff)
downloadastro-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.md5
-rw-r--r--packages/astro/components/ViewTransitions.astro4
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);