marko-js / htmljs-parser

An HTML parser recognizes content and string placeholders and allows JavaScript expressions as attribute values
MIT License
135 stars 20 forks source link

Closing tag names include trailing whitespace #174

Open AngusMorton opened 6 months ago

AngusMorton commented 6 months ago

The following HTML/Marko doesn't parse because the closeTagName is parsed with whitespace and so the open and close tag names don't match.

<span class="dolorum atque aspernatur"
  >Est molestiae sunt facilis qui rem.</span
>
<span class="dolorum atque aspernatur"
  >Est molestiae sunt facilis qui rem.</span
                                        ^^^^ 
       The closing "span\n" tag does not match the corresponding opening "span" tag.
>

I would expect the closeTagName to be "span" and the closeTagEnd to be "\n>"... But I don't know if that makes sense. Alternatively, we consume and discard the whitespace between closeTagName and closeTagEnd. I also don't know how this change would impact upstream dependencies.