Handle noscript tags in head during ViewTransitions (#8091)

This commit is contained in:
Martin Trapp 2023-08-15 22:26:37 +02:00 committed by GitHub
parent 76a2ba270d
commit 56e7c5177b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Handle `<noscript>` tags in `<head>` during ViewTransitions

View file

@ -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);