Skip to content

Commit

Permalink
style(esl-mixin-element): simplify subtree check conditions
Browse files Browse the repository at this point in the history
Co-authored-by: Anna <abarmina@exadel.com>
  • Loading branch information
ala-n and abarmina committed Jul 11, 2024
1 parent 7877ead commit 3deab66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/esl-mixin-element/ui/esl-mixin-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class ESLMixinRegistry {
public invalidateRecursive(root: HTMLElement = document.body, name?: string): void {
if (!root) return;
name ? this.invalidate(root, name) : this.invalidateAll(root);
if (!root.children || !root.children.length) return;
if (!root.children?.length) return;
Array.prototype.forEach.call(root.children, (child: Element) => this.invalidateRecursive(child as HTMLElement, name));
}

Expand Down Expand Up @@ -174,7 +174,7 @@ export class ESLMixinRegistry {
private static destroyAll(el: HTMLElement): void {
const store = (el as any)[STORE] as Record<string, ESLMixinElement> | undefined;
store && Object.keys(store).forEach((name) => ESLMixinRegistry.destroy(el, name));
if (!el.children || !el.children.length) return;
if (!el.children?.length) return;
Array.prototype.forEach.call(el.children, (child: Element) => ESLMixinRegistry.destroyAll(child as HTMLElement));
}
}

0 comments on commit 3deab66

Please sign in to comment.