diff options
Diffstat (limited to 'packages/integrations/lit/client-shim.js')
-rw-r--r-- | packages/integrations/lit/client-shim.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/integrations/lit/client-shim.js b/packages/integrations/lit/client-shim.js new file mode 100644 index 000000000..cab3fe4d9 --- /dev/null +++ b/packages/integrations/lit/client-shim.js @@ -0,0 +1,10 @@ +async function polyfill() { + const { hydrateShadowRoots } = await import('@webcomponents/template-shadowroot/template-shadowroot.js'); + hydrateShadowRoots(document.body); +} + +const polyfillCheckEl = new DOMParser().parseFromString(`<p><template shadowroot="open"></template></p>`, 'text/html', { includeShadowRoots: true }).querySelector('p'); + +if (!polyfillCheckEl || !polyfillCheckEl.shadowRoot) { + polyfill(); +} |