From 0ccc76254f013f67648457cffdf99601ff169495 Mon Sep 17 00:00:00 2001 From: Will Eastcott Date: Fri, 6 Sep 2024 13:15:49 +0100 Subject: [PATCH] Fix React Element component --- src/components/Element/component.tsx | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/components/Element/component.tsx b/src/components/Element/component.tsx index cc85de25..0bd7761d 100644 --- a/src/components/Element/component.tsx +++ b/src/components/Element/component.tsx @@ -19,7 +19,7 @@ class Component

extends React.Component { link: ElementArgs["link"]; - onAttach?: any; + onAttach?: () => void; class: Set; @@ -42,23 +42,13 @@ class Component

extends React.Component { attachElement = (nodeElement: HTMLElement, containerElement: any) => { if (!nodeElement) return; - if (this.elementClass === Element) { - this.element = new this.elementClass( - nodeElement, - { - ...this.props, - container: containerElement, - parent: undefined - } - ); - } else { - this.element = new this.elementClass({ - ...this.props, - dom: nodeElement, - content: containerElement, - parent: undefined - }); - } + + this.element = new this.elementClass({ + ...this.props, + dom: nodeElement, + content: containerElement, + parent: undefined + }); const c = this.props.class; this.class = new Set(c ? (Array.isArray(c) ? c.slice() : [c]) : undefined);