From 7ba7bad6befd0fee40f820f1b6bcd0301905c41f Mon Sep 17 00:00:00 2001 From: Owen Niblock Date: Thu, 29 Feb 2024 12:37:08 +0000 Subject: [PATCH 1/2] HTMLSlotElement needs SSR support --- src/tab-container-element.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tab-container-element.ts b/src/tab-container-element.ts index 2308a1c..7a52d60 100644 --- a/src/tab-container-element.ts +++ b/src/tab-container-element.ts @@ -1,4 +1,5 @@ const HTMLElement = globalThis.HTMLElement || (null as unknown as (typeof window)['HTMLElement']) +const HTMLSlotElement = globalThis.HTMLSlotElement || (null as unknown as (typeof window)['HTMLSlotElement']) const manualSlotsSupported = 'assign' in HTMLSlotElement.prototype export class TabContainerChangeEvent extends Event { From a9ac5100b361bf46891e4bcfdfd2d92335866ec3 Mon Sep 17 00:00:00 2001 From: Owen Niblock Date: Thu, 29 Feb 2024 12:57:20 +0000 Subject: [PATCH 2/2] Only use globalThis on creation of manualSlotsSupported --- src/tab-container-element.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tab-container-element.ts b/src/tab-container-element.ts index 7a52d60..431b63c 100644 --- a/src/tab-container-element.ts +++ b/src/tab-container-element.ts @@ -1,6 +1,5 @@ const HTMLElement = globalThis.HTMLElement || (null as unknown as (typeof window)['HTMLElement']) -const HTMLSlotElement = globalThis.HTMLSlotElement || (null as unknown as (typeof window)['HTMLSlotElement']) -const manualSlotsSupported = 'assign' in HTMLSlotElement.prototype +const manualSlotsSupported = 'assign' in (globalThis.HTMLSlotElement?.prototype || {}) export class TabContainerChangeEvent extends Event { constructor(type: string, {tab, panel, ...init}: EventInit & {tab?: Element; panel?: Element}) {