mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
72c7ae9901
* update formatter config * format --------- Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
16 lines
429 B
JavaScript
16 lines
429 B
JavaScript
async function polyfill() {
|
|
const { hydrateShadowRoots } = await import(
|
|
'@webcomponents/template-shadowroot/template-shadowroot.js'
|
|
);
|
|
window.addEventListener('DOMContentLoaded', () => hydrateShadowRoots(document.body), {
|
|
once: true,
|
|
});
|
|
}
|
|
|
|
const polyfillCheckEl = Document.parseHTMLUnsafe(
|
|
`<p><template shadowrootmode="open"></template></p>`,
|
|
).querySelector('p');
|
|
|
|
if (!polyfillCheckEl?.shadowRoot) {
|
|
polyfill();
|
|
}
|