Closed seagreen closed 4 years ago
For proper SVG support I'd do the following:
VNode
and VLeaf
VDOM
constructors to include a flag that indicates whether to use the *NS
functions*AttributeNS
functions whenever an attribute is created/updated on an NS
nodeSVG
and SVG.Props
modules which export all SVG tags (e.g. g
, polyline
etc) and attributesI won't be able to implement this myself at the moment, but I'd definitely help however I can if you decide to open up a PR!
That seems like a solid plan. I'll let you know if I start on it.
Going to take a stab at it.
It's listed in the "Roadmap" section of the README, but I thought it would be good to have an issue for it too.
I've got a branch that supports SVG currently: https://github.com/seagreen/replica/commit/434ec5ad8daa834a83849f0d51489f40250acf94
It checks for an
xmlns
property on a node or leaf, and if it's present usescreateElementNS
instead ofcreateElement
.This works in my case, but I'm not sure it's a fully complete solution. For one thing it doesn't use
createAttributeNS
which may be necessary in some cases. I thought I'd go ahead and open this issue though to see if you've got thoughts on how you'd like SVG support to work.