When attribute values are undefined or null they are appended as strings 'undefined' or 'null'.
For example this code:
var none // unassigned
hx`<li.item class=${none}>...</li>`
Will result in html like this:
<li class="item undefined">...</li>
Whereas virtual-hyperscript will ignore the value and not add it to the class list.
I'm not sure if this is the correct behavior, but i expected it to do the same as virtual-hyperscript. This can be achieved by the developer by supplying a custom concat function, or by ensuring that undefined values are never used, but i think this should be handled by default?
If it is a bug, I think it can be fixed in the concat function, by making undefined parameters default to empty strings (''). However maybe there is a better way to do it?
When attribute values are
undefinedornullthey are appended as strings 'undefined' or 'null'.For example this code:
Will result in html like this:
Whereas
virtual-hyperscriptwill ignore the value and not add it to the class list.I'm not sure if this is the correct behavior, but i expected it to do the same as
virtual-hyperscript. This can be achieved by the developer by supplying a custom concat function, or by ensuring that undefined values are never used, but i think this should be handled by default?If it is a bug, I think it can be fixed in the concat function, by making undefined parameters default to empty strings (''). However maybe there is a better way to do it?