Skip to content

Commit

Permalink
Fix React Element component (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
willeastcott authored Sep 6, 2024
1 parent cc58b94 commit cf92e84
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions src/components/Element/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Component <P extends ElementArgs, S> extends React.Component <P, S> {

link: ElementArgs["link"];

onAttach?: any;
onAttach?: () => void;

class: Set<string>;

Expand All @@ -42,23 +42,13 @@ class Component <P extends ElementArgs, S> extends React.Component <P, S> {

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);
Expand Down

0 comments on commit cf92e84

Please sign in to comment.