blob: ca97b92cc1fbb8e350fd6ea2829ada58e83ceeac (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
async function polyfill() {
const { hydrateShadowRoots } = await import(
'@webcomponents/template-shadowroot/template-shadowroot.js'
);
window.addEventListener('DOMContentLoaded', () => hydrateShadowRoots(document.body), {
once: true,
});
}
const polyfillCheckEl = new DOMParser()
.parseFromString(`<p><template shadowroot="open"></template></p>`, 'text/html', {
includeShadowRoots: true,
})
.querySelector('p');
if (!polyfillCheckEl || !polyfillCheckEl.shadowRoot) {
polyfill();
}
|