diff --git a/src/directives/if.ts b/src/directives/if.ts index b578b39..eba8427 100644 --- a/src/directives/if.ts +++ b/src/directives/if.ts @@ -13,7 +13,7 @@ export const _if = (el: Element, exp: string, ctx: Context) => { console.warn(`v-if expression cannot be empty.`) } - const parent = el.parentElement! + const parent = el.parentElement ? el.parentElement : el.parentNode const anchor = new Comment('v-if') parent.insertBefore(anchor, el)