Skip to content

Commit

Permalink
fix removeChildWrapperIfEmpty behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
e11sy committed Oct 30, 2024
1 parent 7c74b64 commit 7f0612c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/removeChildWrapperIfEmpty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import { getChildItems } from './getChildItems';
* @param childWrapper - childWrapper to be removed if it is empty
*/
export function removeChildWrapperIfEmpty(childWrapper: ItemChildWrapperElement): void {
if (getChildItems(childWrapper) === null) {
/**
* Check that there is at least one item
*/
if (getChildItems(childWrapper).length === 0) {
childWrapper.remove();
}
}

0 comments on commit 7f0612c

Please sign in to comment.