From e7324c18705153fc4c6754bcda539a37621c5cf1 Mon Sep 17 00:00:00 2001 From: Tyson Cung Date: Mon, 23 Feb 2026 05:53:53 +0000 Subject: [PATCH] fix: guard attachShadow call for SSR DOMs without native support Server-side DOM implementations like Domino do not provide attachShadow on host elements, causing hydration to crash with 'TypeError: this.attachShadow is not a function'. Add a typeof check before calling attachShadow so hydration can continue gracefully in environments where shadow DOM is unavailable. Fixes #6605 --- src/utils/shadow-root.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/utils/shadow-root.ts b/src/utils/shadow-root.ts index 2b85d45aebe..1e9494fd3ec 100644 --- a/src/utils/shadow-root.ts +++ b/src/utils/shadow-root.ts @@ -26,6 +26,13 @@ export function createShadowRoot(this: HTMLElement, cmpMeta: d.ComponentRuntimeM } } + // Guard against server-side DOM implementations (e.g. Domino) that do not + // provide `attachShadow` on host elements. In those environments we fall + // back gracefully so hydration can continue without crashing (#6605). + if (typeof this.attachShadow !== 'function') { + return; + } + const shadowRoot = this.attachShadow(opts); // Initialize if undefined, set to CSSStyleSheet or null