From c4054c02326baa0221def9c671a0b0c9458744bd Mon Sep 17 00:00:00 2001 From: chloe <82487807+owochlo@users.noreply.github.com> Date: Wed, 14 Apr 2021 23:30:16 -0700 Subject: [PATCH] Short circuit conditional --- src/core/compile.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/compile.ts b/src/core/compile.ts index de23e79..d3c4256 100644 --- a/src/core/compile.ts +++ b/src/core/compile.ts @@ -10,8 +10,7 @@ export const isListRenderScope = (el: HTMLElement): boolean => { }; export const isUnderListRenderScope = (el: HTMLElement): boolean => { - if (!el.parentElement) return false; - return el.parentElement.hasAttribute(`${DIRECTIVE_PREFIX}for`); + return el.parentElement && el.parentElement.hasAttribute(`${DIRECTIVE_PREFIX}for`); }; export const createASTNode = (el: HTMLElement, state: State): ASTNode | undefined => {