From ae45e5ef487479f987829119dd098c17e47d3ce8 Mon Sep 17 00:00:00 2001 From: ghiscoding Date: Fri, 24 Nov 2023 15:13:30 -0500 Subject: [PATCH] chore: simplify `emptyElement()` method --- src/slick.core.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/slick.core.ts b/src/slick.core.ts index 8cfd556d..daa91bf8 100644 --- a/src/slick.core.ts +++ b/src/slick.core.ts @@ -764,13 +764,9 @@ export class Utils { return elm; } - public static emptyElement(element: HTMLElement | null) { - if (element?.firstChild) { - while (element.firstChild) { - if (element.lastChild) { - element.removeChild(element.lastChild); - } - } + public static emptyElement(element?: T | null): T | undefined | null { + while (element?.firstChild) { + element.removeChild(element.firstChild); } return element; }