diff --git a/packages/astro/src/runtime/server/index.ts b/packages/astro/src/runtime/server/index.ts index e94de7732..fd401fbc8 100644 --- a/packages/astro/src/runtime/server/index.ts +++ b/packages/astro/src/runtime/server/index.ts @@ -459,10 +459,14 @@ export async function renderHTMLElement(result: SSRResult, constructor: typeof H function getHTMLElementName(constructor: typeof HTMLElement) { const definedName = (customElements as CustomElementRegistry & { getName(_constructor: typeof HTMLElement): string }).getName(constructor); - if (definedName) return definedName + if (definedName) return definedName; - const assignedName = constructor.name.replace(/^HTML|Element$/g, '').replace(/[A-Z]/g, '-$&').toLowerCase().replace(/^-/, 'html-') - return assignedName + const assignedName = constructor.name + .replace(/^HTML|Element$/g, '') + .replace(/[A-Z]/g, '-$&') + .toLowerCase() + .replace(/^-/, 'html-'); + return assignedName; } function renderElement(name: string, { props: _props, children = '' }: SSRElement) {