Skip to content

Conversation

@loteoo
Copy link
Contributor

@loteoo loteoo commented Jun 10, 2022

Currently, if you try to render a node like this:

text('')

It will actually render undefined 🤔

It goes through this part of the code to get HTML escaped, however, because the || operator considers '' a falsy value, it goes for node.name instead, which does not exist on a VDOM node. The first line in this escapeHtml function converts this undefined value to string, which ends up being the string 'undefined'.

I think this is a bug?

Hope this helps!

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
Currently, if you try to render a node like this: ```js text('') ``` It will go through this part of the code to get HTML escaped, however, because the `||` operator considers `''` a falsy value, it goes for `node.name` instead, which does not exist on a VDOM node. The first line in this `escapeHtml` function converts this `undefined` value to string, which ends up being the string `'undefined'`. I think this is a bug? Hope this helps!
@frenzzy frenzzy merged commit 6470b74 into kriasoft:master Jun 29, 2022
@frenzzy
Copy link
Member

frenzzy commented Jun 29, 2022

Just released under v4.0.1 🎉 Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants