0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-06 22:10:10 -05:00

🐛 removed deprecated items from lit integration (#11164)

* 🐛 removed deprecated items from lit integration

* 🚀 update minified

* 🐛 need `Document`
This commit is contained in:
Scott Nath 2024-05-29 16:00:31 -04:00 committed by GitHub
parent 369069a173
commit cf9b2ff796
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 17 deletions

View file

@ -0,0 +1,5 @@
---
"@astrojs/lit": minor
---
Removes deprecated `template` attribute and replaces deprecated domparser function

View file

@ -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) {

View file

@ -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();