Fix issue rendering content within HTMLElement (#2506)
This commit is contained in:
parent
4ddb44caea
commit
187d5128af
2 changed files with 7 additions and 7 deletions
5
.changeset/calm-suns-give.md
Normal file
5
.changeset/calm-suns-give.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix an issue rendering content within HTMLElement
|
|
@ -442,7 +442,7 @@ export async function renderAstroComponent(component: InstanceType<typeof AstroC
|
||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function renderHTMLElement(result: SSRResult, constructor: typeof HTMLElement, props: any, children: any) {
|
export async function renderHTMLElement(result: SSRResult, constructor: typeof HTMLElement, props: any, slots: any) {
|
||||||
const name = getHTMLElementName(constructor);
|
const name = getHTMLElementName(constructor);
|
||||||
|
|
||||||
let attrHTML = '';
|
let attrHTML = '';
|
||||||
|
@ -451,12 +451,7 @@ export async function renderHTMLElement(result: SSRResult, constructor: typeof H
|
||||||
attrHTML += ` ${attr}="${toAttributeString(await props[attr])}"`;
|
attrHTML += ` ${attr}="${toAttributeString(await props[attr])}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
children = await children;
|
return `<${name}${attrHTML}>${await renderSlot(result, slots?.default)}</${name}>`;
|
||||||
children = children == null ? children : '';
|
|
||||||
|
|
||||||
const html = `<${name}${attrHTML}>${children}</${name}>`;
|
|
||||||
|
|
||||||
return html;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHTMLElementName(constructor: typeof HTMLElement) {
|
function getHTMLElementName(constructor: typeof HTMLElement) {
|
||||||
|
|
Loading…
Reference in a new issue