Skip to content

Commit

Permalink
🐛 removed deprecated items from lit integration (#11164)
Browse files Browse the repository at this point in the history
* 🐛 removed deprecated items from lit integration

* 🚀 update minified

* 🐛 need `Document`
  • Loading branch information
scottnath authored May 29, 2024
1 parent 369069a commit cf9b2ff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-meals-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/lit": minor
---

Removes deprecated `template` attribute and replaces deprecated domparser function
10 changes: 2 additions & 8 deletions packages/integrations/lit/client-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
11 changes: 2 additions & 9 deletions packages/integrations/lit/client-shim.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

0 comments on commit cf9b2ff

Please sign in to comment.