blob: c28ee5edf32c901453f318906431a8160a194d59 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
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();
}
|