html2hyperscript icon indicating copy to clipboard operation
html2hyperscript copied to clipboard

Does not parse style attribute

Open wclr opened this issue 9 years ago • 3 comments

Does not parse style attribute, stays as string. Which seem to be not valid. https://github.com/Matt-Esch/virtual-dom/issues/204

wclr avatar Apr 10 '16 09:04 wclr

Thanks for reporting this, I can see that this breaks virtual-dom expectations. The solution would be to do a rudimentary CSS parse, convert property names to camelCase and output an object, I guess. This also makes me wonder about the class attribute (should it be converted to className?).

unframework avatar Apr 10 '16 18:04 unframework

Well they maybe leaved in as is, so style="background-color: red" -> `"style": {"background-color": "red"}

anyway your module is doing some kind of JSON (all the properties name have quotes), but it would be nice to have an option that it would create not json but js object like `style: {backgroundColor: "red"}

as well it would be useful to have ability to have instead h("div.someclass", ...) -> div("someclass", ...)

wclr avatar Apr 10 '16 19:04 wclr

btw it seem that better solution will be to place all the attributes to attributes this will solve other issues and this too.

wclr avatar Apr 10 '16 22:04 wclr