justinwilaby / sax-wasm

The first streamable, fixed memory XML, HTML, and JSX parser for WebAssembly.
MIT License
168 stars 8 forks source link

Error with JSX parsing of inline valid javascript expressions including `<` #81

Open marcusglowe opened 10 months ago

marcusglowe commented 10 months ago

Describe the bug Suppose you have the following:

<foo>{bar < baz ? <div></div> : <></>}</foo>

The SAX parser will detect that <baz ? <div> is a tag To Reproduce Use this example

Expected behavior I expect that any complex expression is ignored from the parser, even if it contains <

I'd be happy to help fix if there are code pointers / strategies that would be effective in solving this!

justinwilaby commented 10 months ago

I have been able to confirm this defect. Nice catch!

I would expect the parser to report any nodes that exist in the jsx expression. This might be quite the rabbit hole however. I'll explore some options soon and report back.