vjeux / jsxdom

DOM backend for JSX
45 stars 13 forks source link

Numeric values cause errors #7

Open asunar opened 8 years ago

asunar commented 8 years ago

jsxdom creates a text node only if the children's type is string (line 5). If the type is number, it throws an error on line 12. Below is an example of this behavior.

is this the expected behavior?

Thanks.

 /** @jsx JSXDOM */

var aNumber= 5;
//document.body.appendChild(<span>{aNumber}</span>); => Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
document.body.appendChild(<span>{aNumber.toString()}</span>); //works
lucanos commented 8 years ago

Same problem here - we need it to create a text node if the type is a string, or numeric.