Closed AnReZa closed 4 years ago
Might be a duplicate of #709, but no solution there.
My best guess is, that the imported svg has nodes created in the wrong namespace and when we add the correct ones, its not counted as the same. But thats really a hard guess.
Importing in 2.x was implemented in a bad way. Unfortunately changing it would be a major break. Thats why I suggest using 3.0 instead
@Fuzzyma I actually tried to upgrade to 3.x, but I get some strange errors there (see https://github.com/svgdotjs/svg.select.js/issues/59). And, as far as I'm concerned, the svg.select.js extension is still not ported to 3.x, or is it?
No unfortunately it is not. There is only a branch with (not so) ongoing development for the next version that would be compatible.
In my project (still with version 2.7.x), the user can add SVG annotations to a picture and save them to the server. However, after reloading the stored SVG node from the server and applying the
SVG
method to the node again, it redundandly adds the xmlns:svgjs attribute, so I end up with this:Here's an extract from my knockout binding, which adds the node to the DOM:
If there is no stored node yet, it adds the template. Otherwise it will load the node stored on the server. If it is stored on the server, it will contain a single occurance of the xmlns:svgjs="http://svgjs.com/svgjs" declaration. So after calling
SVG()
on this node again, it will duplicate the declaration.Is that a bug, or is there any way to prevent that?