importing svg.js drops everything inside a link tag

160 Views Asked by At

i load a svg file like this

var draw=SVG('container');
var rawSVG=$('rawSVG').get('html'); //get content of invisible div with mootools
draw.svg(rawSVG);

in rawSVG DIV i can see the link tags. But in container, everything inside of the link tags is dropped and i get empty tags

in import.svg.js the only thing related to xlink:href i could found is related to image

element = context.image(attr['xlink:href'])

the links are created by svg.js and saved by export.svg.js correctly but on importing the next time the get dropped.

edit: i want to load a svg graphic into an cms and than be able to modify the graphic. it is working fine but on next import the text within the link tag get dropped.

edit 2 ok, now i loose the xlink element but the child elements are kept

what i want is to change a svg node in an external svg file i include in a hidden div called rawSVG in witch i see

 ...//more svg

    <a xlink:href="test/" id="lktest">
      <text y="86.83333396911621" x="100" font-family="Muli" id="txtest">
        <tspan dy="1.8em" x="0" id="tstest">test</tspan>
      </text>
    </a>

  ...//more svg

than i grab the content of that div with mootools

var rawSVG=$('rawSVG').get('html');

and than i do

draw.svg(rawSVG);

to make it editable in svg.js

but in my container div i see

... //more svg
  <text y="86.83333396911621" x="100" font-family="Muli" id="txtest">
    <tspan dy="1.8em" x="0" id="tstest">test</tspan>
  </text>
... //more svg

the ink was created and exported with svg.js and works. this behavior happens after reload

i have the xmlns:xlink="http://www.w3.org/1999/xlink" in my svg node I tried html 5 and html 4 strict i tried svg with doctype and without

I also tried images and they get dropped aswell it's like the xml link namespace is not recognized

i tried to set the namespace of xlink like in the comment of the answer to this cuestion: xmlserializer strips xlink from xlink:html svg image tag but nothing changed

any suggestion what I'm doing wrong?

0

There are 0 best solutions below