Closed martindemello closed 7 years ago
(Side note: How do you look at the generated HTML? The library creates DOM nodes and set DOM properties, not HTML attributes. It would not be very difficult to support setting attributes if needed, but most attributes have some property counterpart (sometimes with a different name), so I'm not sure this is strictly required.)
I suspect the problem is related to the fact that one should use createElementNS
with the correct SVG namespace to create SVG elements, while the library currently always use createElement
(which is fine for HTML elements). The namespace should be an extra argument to the elt
"constructor" (taken into account when comparing tags during vdom synchronization), or perhaps one could encode it as part of the tag itself (e.g. "namespace:local_name" to avoid comparing two strings during the diffing).
So it seems that SVG attributes really need to be handled as attributes, there is no corresponding DOM properties as for (most) HTML attributes.
you're right, it's technically the generated DOM rather than the generated HTML. i view it in chrome by calling "inspect" from the right-click menu.
does your second comment mean that svg is currently not supported? i'd offer to help add it but i didn't even know dom properties and attributes were different things, so i suspect i wouldn't get very far :)
My previous comments indeed meant that SVG was not supported at the time they were written. Now, it is (since the last commit one minute ago).
that was fast! thanks for the quick fix.
I'm trying to add an SVG rectangle element:
but the rendered HTML only contains the existing class_ attribute:
the other attributes I tried to add via str_prop get silently dropped.