Skip to content

Commit 09c2805

Browse files
author
Kai
authored
Accept undefined & null in append() & prepend() (#11)
2 parents be9ad42 + cb8062f commit 09c2805

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/BaseComponent.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ export abstract class BaseComponent<T extends Element> {
5656
/**
5757
* Insert component after the last child
5858
*/
59-
public append(component: BaseComponent<any>) {
60-
this.element.appendChild(component.element);
59+
public append(...components: BaseComponent<any>[]) {
60+
components.forEach((component) => this.element.appendChild(component.element))
6161
return this;
6262
}
6363

6464
/**
6565
* Insert component before the first child
6666
*/
67-
public prepend(component: BaseComponent<any>) {
68-
this.element.prepend(component.element);
67+
public prepend(...components: BaseComponent<any>[]) {
68+
components.forEach((component) => this.element.prepend(component.element))
6969
return this;
7070
}
7171

0 commit comments

Comments
 (0)