0

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?

Community
  • 1
  • 1
je mont
  • 1
  • 1
  • Sorry, I don't understand what it is that you want to achieve. Could you clarify? What is `draw.svg` supposed to do? – elpoto Nov 30 '14 at 18:41
  • @elpoto i want to be able to modify a svg graphic in a cms. so i import it update some elements (basically change a text and by that href of a clickable element) and save/export back to a svg file. – je mont Dec 01 '14 at 08:31
  • @elpoto sory did'nt answer the last part of your question: draw.svg as i understand the documentation makes the imported svg available in the instance. otherwise it is just displayed – je mont Dec 01 '14 at 08:48
  • Ok, still not entirely sure, but it sounds like you have to check what the cms actually saves. That way you can find out if the problem occurs on export or on import. – elpoto Dec 04 '14 at 22:13
  • the svg is saved correctly and the xlink namespace get's dropped on import. anyways i am trying a workaround and create and inject the elements with mootool. it's working for now. i hope i will not encounter any problems. easy fixes usually bring problems – je mont Dec 05 '14 at 21:42
  • In the new Version of svg.js, the import and export is already build in. Maybe you have some more luck with this one – Fuzzyma Oct 14 '15 at 21:41

0 Answers0