duplicate xmlns:link attributes
legostud opened this issue · 7 comments
version 5.0.5 is adding the xmlns:link attribute twice to our combined svg file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
version 5.0.4 works fine.
@legostud, can you provide source files? I just need <svg>
elements and their attributes, <svg>
contents are not required.
@legostud please provide a test case or I will have to close this as "can't reproduce".
@legostud I added the test (that is passing) to this branch: https://github.com/w0rm/gulp-svgstore/tree/51-duplicate-namespaces
Well an example would be great because duplicate of attribute names seems very unlikely.
Because we could totally do something wrong on the detect/check of namespace procedure but then the part about adding attribute is very simple :
for (var nsName in namespaces)
$combinedSvg.attr(nsName, namespaces[nsName])
namespaces
being an object it's technically impossible to add the same nsName
twice. And EVEN if we did call attr()
twice with same attribute name it should replace old value not duplicate the attribute.
So this is very odd for me and I have absolutely no idea about how this is possible.
@legostud Also quick guess, if it works on gulp-svgstore 5.0.4, and since this version is not adding any namespace, this is probably because you are adding it yourself.
This is maybe why you end up with duplicate namespace on version 5.0.5 : first one added by gulp-svgstore and second one by you.