w0rm / gulp-svgstore

Combine svg files into one with symbol elements

Home Page:https://www.npmjs.com/package/gulp-svgstore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

duplicate xmlns:link attributes

legostud opened this issue · 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".

/cc @ghetolay what do you think of this issue?

commented

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.

commented

@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.

@ghetolay yeah, could be it. Anyway, I am closing this because @legostud is not responding.