Bloomca / veles

UI library with main focus on performance
https://bloomca.github.io/veles/
MIT License
40 stars 0 forks source link

Support string/undefined/null as a return type in a component #7

Closed Bloomca closed 1 month ago

Bloomca commented 1 month ago

Right now you have to return a valid DOM element (or a Component, but eventually it will have to return a DOM element).

This can be solved (at least in theory) by utilizing TextNodes. Since it is a Node, we can use insertBefore method to achieve a similar behavior to replace() from ElementNodes.

In case of undefined or null, we can simply create an empty Text Node. This should not cause any interference as far as I am aware.