Skip to content

Commit 7507b64

Browse files
authored
Allow empty string text nodes
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!
1 parent 9216014 commit 7507b64

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export function renderer(view, state, actions) {
251251
footer: '',
252252
})
253253
} else if (node.type === 3) {
254-
out += escapeHtml(node.tag || node.name)
254+
out += escapeHtml(node.tag != null ? node.tag : node.name)
255255
} else if (typeof node === 'object') {
256256
out += renderFragment(
257257
node.tag || node.nodeName,

0 commit comments

Comments
 (0)