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; }