blob: c3ac563ca30c4c31e0b77ecaf931c001f05804d8 (
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 = new DOMParser()
.parseFromString(`<p><template shadowroot="open"></template></p>`, 'text/html', {
includeShadowRoots: true,
})
.querySelector('p');
if (!polyfillCheckEl || !polyfillCheckEl.shadowRoot) {
polyfill();
}
|