rapscallion icon indicating copy to clipboard operation
rapscallion copied to clipboard

Attributes with numeric value not rendered

Open mohtar opened this issue 7 years ago • 1 comments

<textarea rows="10" /> is OK but <textarea rows={10} /> where the attribute value is a number results in not being rendered.

mohtar avatar May 11 '17 09:05 mohtar

I think the cause is the same as #77 .

https://github.com/FormidableLabs/rapscallion/blob/master/src/render/attrs/index.js#L31

As attrVal is in this case 10, the condition Object.keys(attrVal).length > 0 is not satisfied and thus no attribute is inserted, same case when the value is true (my problem on isue #77 ).

I am not sure what that condition is supposed to check so I have been unwilling to submit a pull request.

My suggestion would be to change that check for something that would allow numeric and boolean values (or at least true) and explain in a comment what that check is supposed to do because it is really unclear right now and it prevents us from helping solving issues.

mijamo avatar May 19 '17 08:05 mijamo