Fix issue rendering content within HTMLElement (#2506)

This commit is contained in:
Jonathan Neal 2022-01-31 16:50:55 -05:00 committed by GitHub
parent 4ddb44caea
commit 187d5128af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix an issue rendering content within HTMLElement

View file

@ -442,7 +442,7 @@ export async function renderAstroComponent(component: InstanceType<typeof AstroC
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);
let attrHTML = '';
@ -451,12 +451,7 @@ export async function renderHTMLElement(result: SSRResult, constructor: typeof H
attrHTML += ` ${attr}="${toAttributeString(await props[attr])}"`;
}
children = await children;
children = children == null ? children : '';
const html = `<${name}${attrHTML}>${children}</${name}>`;
return html;
return `<${name}${attrHTML}>${await renderSlot(result, slots?.default)}</${name}>`;
}
function getHTMLElementName(constructor: typeof HTMLElement) {