SVGInjector2 icon indicating copy to clipboard operation
SVGInjector2 copied to clipboard

SVGInjector messes up id's inside defs

Open yiotaz opened this issue 8 years ago • 6 comments

This is a reference issue, since the old version seems a bit abandoned. https://github.com/iconic/SVGInjector/issues/29

Can you help me sort this out? I can send you my svg file if it will help somehow.

yiotaz avatar Mar 01 '17 15:03 yiotaz

Hi, do you still have this issue, and if, does it happen with svginjector2 or with the original version? Since the original issue seems to be resolved, I would like to close this too.. thx!

flobacher avatar Mar 05 '17 10:03 flobacher

I hate to say that we are having exactly the same issue here with v2.1.3

gebeer avatar Mar 15 '18 12:03 gebeer

As a temp workaround for our use case I uncommented https://github.com/flobacher/SVGInjector2/blob/master/src/svg-injector.js#L390 This helped

gebeer avatar Mar 15 '18 12:03 gebeer

@gebeer could you please provide a sample so I can reproduce this? thank you!

flobacher avatar Mar 16 '18 15:03 flobacher

@flobacher I setup a test to reconfirm the issue. But in the isolated test context it won't happen. The problem only appears to happen in IE11/Edge where clip-path ids are incorrect. In the svg folder of the test repo are the original svg and the injected versions. One injected with Firefox, one with Edge. If you compare those, you will see that for the Edge version, the clipPath IDs inside get appended a '-0' while the clip-path attributes further down are lacking that '-0' Example Edge: L. 17 inside : <clipPath id="clip-path-2-0"> L.365 : <g clip-path="url(&quot;#clip-path-2&quot;)">

In the Firefox version the '-0' gets appended correctly also in L365

Here's how the problematic SVG looks in original context in Edge: image

Hope this is of any help. Unfortunately I can't supply a live non-working example.

gebeer avatar Mar 17 '18 04:03 gebeer

@gebeer thank you for that example! I will try to take a look. I must apologize if it takes a bit of time, but I only do this in my spare time and my timely-ressources are limited. I would be more than happy to accept a PR ofc =) Also I experienced something similar once with Edge 14, but with 16 the issue went away..

flobacher avatar Mar 20 '18 08:03 flobacher