0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

probably now obsolete part for issue 9953

This commit is contained in:
Martin Trapp 2024-02-10 12:17:58 +01:00
parent dacfbf69c5
commit 340fe25f47
3 changed files with 11 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
"@astrojs/lit": patch
---
Adds processing of declarative shadow DOMs (DSD) during view transitions for browsers that do not support DSD natively.

View file

@ -2,7 +2,9 @@ async function polyfill() {
const { hydrateShadowRoots } = await import( const { hydrateShadowRoots } = await import(
'@webcomponents/template-shadowroot/template-shadowroot.js' '@webcomponents/template-shadowroot/template-shadowroot.js'
); );
window.addEventListener('DOMContentLoaded', () => hydrateShadowRoots(document.body), { const listener = () => hydrateShadowRoots(document.body);
document.addEventListener('astro:after-swap', listener);
window.addEventListener('DOMContentLoaded', listener, {
once: true, once: true,
}); });
} }

View file

@ -86,8 +86,9 @@ var S = i(() => {
E(); E();
}); });
async function N() { async function N() {
let { hydrateShadowRoots: t } = await Promise.resolve().then(() => (S(), v)); let { hydrateShadowRoots: t } = await Promise.resolve().then(() => (S(), v)),
window.addEventListener('DOMContentLoaded', () => t(document.body), { once: !0 }); n = () => t(document.body);
window.addEventListener('DOMContentLoaded', n, { once: !0 });
} }
var R = new DOMParser() var R = new DOMParser()
.parseFromString( .parseFromString(