Skip to content

Commit

Permalink
chore: simplify emptyElement() method
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding-SE committed Nov 24, 2023
1 parent 707d223 commit ae45e5e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/slick.core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T extends Element = Element>(element?: T | null): T | undefined | null {
while (element?.firstChild) {
element.removeChild(element.firstChild);
}
return element;
}
Expand Down

0 comments on commit ae45e5e

Please sign in to comment.