Skip to content

Commit

Permalink
fix: block nesting $if
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxMoss committed Oct 1, 2024
1 parent 0942bf1 commit 5a6c7a0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ export function $if(condition, then, otherwise) {
otherwise ??= doc.createTextNode('')
if (!isDLPtr(condition)) return condition ? then : otherwise

assert(
!(IF in then || IF in otherwise),
'Elements in $if cannot also be an $if macro'
)

return { [IF]: condition, then, otherwise }
}

Expand Down

0 comments on commit 5a6c7a0

Please sign in to comment.