From 3fef8cab111b31e98157ea3a14e2a4e533ed2d5f Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Wed, 10 May 2023 11:42:25 +0100 Subject: [PATCH] safely extend DocumentFragment if available --- src/template-instance.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/template-instance.ts b/src/template-instance.ts index 4e6ce0c..ca086ae 100644 --- a/src/template-instance.ts +++ b/src/template-instance.ts @@ -40,7 +40,7 @@ function* collectParts(el: DocumentFragment): Generator { const processors = new WeakMap() const parts = new WeakMap>() -export class TemplateInstance extends DocumentFragment { +export class TemplateInstance extends (globalThis.DocumentFragment || EventTarget) { constructor(template: HTMLTemplateElement, params: unknown, processor: TemplateTypeInit = propertyIdentity) { super() // This is to fix an inconsistency in Safari which prevents us from