Alex
Alex

Reputation: 3257

How to manipulate with embedded SVG data?

I am coding application with SVG and pure JavaScript. I have situation where one of my SVG document fragments is loaded from outer *.svg file and xlinked as <image>. However, I can't call objects (SVG Elements) from this file to manipulate with them. Does DOM support that, am I doing something wrong... it looks trivial, but I can't handle with that.

Something like:

<svg xmlns="http://www.w3.org/2000/svg" 
xmlns:xlink="http://www.w3.org/1999/xlink">
  <svg>
    <someTags
    />
  </svg>
    <g>
      <image id="outerSVG" xlink:href="files/SVGelements.svg" />
    </g>

</svg>

Those problem is drive me crazy, especially for now I need to load saved fragments of SVG and parse it to main SVG, scripted file.

Thanks in advance.

Upvotes: 0

Views: 275

Answers (1)

Erik Dahlstr&#246;m
Erik Dahlstr&#246;m

Reputation: 60966

The <image> element in svg is essentially the same as the <img> element in html, neither of them allow DOM access to the referenced resource.

Upvotes: 1

Related Questions