Refactor components to simplify them

This commit is contained in:
Andras Schmelczer 2022-09-21 14:40:44 +02:00
parent 3cf5b14913
commit 077ed9d3bf
No known key found for this signature in database
GPG key ID: 0EA1BC97D0AB076E
36 changed files with 202 additions and 216 deletions

View file

@ -4,6 +4,11 @@ export abstract class PageElement {
protected children: Array<PageElement> = []
) {}
public attachToDOM(target: HTMLElement) {
target.appendChild(this.htmlRoot);
this.setParent(null);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected setParent(parent?: PageElement | null): void {
this.children.forEach((c) => c.setParent(this));