Don't break in SSR

This commit is contained in:
Lea Verou
2025-02-10 10:20:50 -05:00
parent fd0fad361f
commit 82faf7da36

View File

@@ -26,14 +26,16 @@ export default class WaIsolate extends WebAwesomeElement {
private getShadowHTML(): string {
let html = '';
if (this.include) {
let includedElements = recursiveQSA(this.include, this);
html += includedElements.map(el => el.outerHTML).join('\n');
}
if (this.ownerDocument) {
if (this.include) {
let includedElements = recursiveQSA(this.include, this);
html += includedElements.map(el => el.outerHTML).join('\n');
}
// Get template elements from the light DOM
const templates = Array.from(this.querySelectorAll(':scope > template'));
html += templates.map(template => template.innerHTML).join('\n');
// Get template elements from the light DOM
const templates = Array.from(this.querySelectorAll(':scope > template'));
html += templates.map(template => template.innerHTML).join('\n');
}
return html;
}