diff options
Diffstat (limited to '')
-rw-r--r-- | .changeset/gold-meals-march.md | 5 | ||||
-rw-r--r-- | packages/integrations/lit/client-shim.js | 10 | ||||
-rw-r--r-- | packages/integrations/lit/client-shim.min.js | 11 |
3 files changed, 9 insertions, 17 deletions
diff --git a/.changeset/gold-meals-march.md b/.changeset/gold-meals-march.md new file mode 100644 index 000000000..1ee6face0 --- /dev/null +++ b/.changeset/gold-meals-march.md @@ -0,0 +1,5 @@ +--- +"@astrojs/lit": minor +--- + +Removes deprecated `template` attribute and replaces deprecated domparser function diff --git a/packages/integrations/lit/client-shim.js b/packages/integrations/lit/client-shim.js index bf45dd912..0cd344426 100644 --- a/packages/integrations/lit/client-shim.js +++ b/packages/integrations/lit/client-shim.js @@ -7,14 +7,8 @@ async function polyfill() { }); } -const polyfillCheckEl = new DOMParser() - .parseFromString( - `<p><template shadowroot="open" shadowrootmode="open"></template></p>`, - 'text/html', - { - includeShadowRoots: true, - } - ) +const polyfillCheckEl = Document + .parseHTMLUnsafe(`<p><template shadowrootmode="open"></template></p>`) .querySelector('p'); if (!polyfillCheckEl?.shadowRoot) { diff --git a/packages/integrations/lit/client-shim.min.js b/packages/integrations/lit/client-shim.min.js index 2e3d07ae7..d4dca4dd2 100644 --- a/packages/integrations/lit/client-shim.min.js +++ b/packages/integrations/lit/client-shim.min.js @@ -8,7 +8,7 @@ var b = (t, n) => { function s() { if (d === void 0) { let t = document.createElement('div'); - (t.innerHTML = '<div><template shadowroot="open" shadowrootmode="open"></template></div>'), + (t.innerHTML = '<div><template shadowrootmode="open"></template></div>'), (d = !!t.firstElementChild.shadowRoot); } return d; @@ -79,13 +79,6 @@ async function g() { let { hydrateShadowRoots: t } = await Promise.resolve().then(() => (S(), v)); window.addEventListener('DOMContentLoaded', () => t(document.body), { once: true }); } -var x = new DOMParser() - .parseFromString( - '<p><template shadowroot="open" shadowrootmode="open"></template></p>', - 'text/html', - { - includeShadowRoots: !0, - } - ) +var x = Document.parseHTMLUnsafe('<p><template shadowrootmode="open"></template></p>') .querySelector('p'); (!x || !x.shadowRoot) && g(); |