Rewritting links within included svg files that are not in current directory.


Hi Keith,

(I'm Rémi, and sent you a mail recently, about the download button on your page, but this is unrelated)

Here is the motivation of the pull request.

When I have an html page and use jquery to load an svg in a subfolder, the svg is loaded as expected. However, if the svg file contained relative links inside (link to images or hyperlinks), these become wrong. More exactly, they change meaning: the paths were expressed relative to the SVG file but they are now within the html page and thus represent things relative to the html page.

I made a patch to jquery svg to rewrite these relative links. The pull request contains this, together with adding some information to the onLoad callbacks: the width and the height of the svg element (before it gets lost by the embedding into html).

I have also a branch "test-patches"¹ that provides some html and svg files to illustrate the patches.

Cheers,
Rémi

¹: https://github.com/twitwi/svg/tree/test-patches