Skip to content

Commit

Permalink
fix: handle empty noInnerParse html nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Antony0101 committed Aug 29, 2024
1 parent 3a04b9e commit 577cf72
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions index.compiler.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4684,3 +4684,12 @@ it('handles naked brackets in link text', () => {
</a>
`)
})

it('#597 handles script tag with empty content', () => {
render(compiler('<script src="dummy.js"></script>'))

expect(root.innerHTML).toMatchInlineSnapshot(`
<script src="dummy.js">
</script>
`)
})
2 changes: 1 addition & 1 deletion index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,7 @@ export function compiler(
render(node, output, state) {
return (
<node.tag key={state.key} {...node.attrs}>
{node.text || output(node.children, state)}
{node.text || (node.children ? output(node.children, state) : '')}
</node.tag>
)
},
Expand Down

0 comments on commit 577cf72

Please sign in to comment.