Closed cmtt closed 9 years ago
But then what will happen if someone just feeds text to it? I think we should check if node.children.length and use firstChild if it is 0
Indeed! I have updated the pull request for this use case.
awesome, thank you!
With the update to vdom-virtualize 0.0.11, fromHTML() changed its behavior due to the recent fix for #21. If a HTML string contains whitespace characters at the very beginning, it creates a VirtualText node instead. This might occur with certain template engines and configurations or when using HTML which wasn't generated by a machine.
This is due to the return value of Node.firstChild (which was introduced with the new version). It includes TextNodes which derive from any whitespace or control character in the provided HTML (see MDN) or this example:
The old behavior of using Node.children should be restored for a better developing experience.