dot-dom icon indicating copy to clipboard operation
dot-dom copied to clipboard

Does not handle children that are numbers

Open SilentCicero opened this issue 7 years ago • 5 comments

Does not nicely handle vnode instances which are numbers, only strings. Maybe if type number => render to string.

SilentCicero avatar Mar 23 '17 02:03 SilentCicero

Ouch, that's indeed a tricky one. I will try to find a good solution for this, but right now it's not easy, since I am relying on string's properties to identify it.

wavesoft avatar Mar 26 '17 02:03 wavesoft

Imo that's not a big limitation. I think it's fair to assume that numbers need to be casted to strings by components. The same problem also exists for null and false which are valid render values in React. Both the null and the false case can be expressed as "" which I think is fine.

jhnns avatar Dec 20 '18 22:12 jhnns

For the record, we're talking about these lines here, right?

I'm wondering, can we simply reverse the test and the condition?

So instead of vnode.replace, how about e.g. !!vnode.a?

This should match anything that's not a vnode object, including strings, numbers and booleans, right?

(if that works, also maybe swap the terminals of the ternary expression and save one of the ! operators.)

mindplay-dk avatar Oct 06 '19 16:10 mindplay-dk

I think we can close this?

mindplay-dk avatar Jan 07 '22 12:01 mindplay-dk

...although it's still on a devel branch that might should be merged back to master?

mindplay-dk avatar Jan 07 '22 13:01 mindplay-dk