#14008 closed defect (fixed)
images aren't exported correctly to SVG
Reported by: | vvoovv | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | DojoX GFX | Version: | 1.7.0b1 |
Keywords: | Cc: | Chris Mitchell | |
Blocked By: | Blocking: |
Description
Correct SVG with images should look like:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" overflow="hidden">
...
<image xlink:href="http://someUrl" ... ></image>
...
</svg>
Now open dojox/gfx/tests/test_utils.html
The exported SVG doesn't contain xmlns:xlink="http://www.w3.org/1999/xlink"
Images are exported with href tag but not with xlink:href tag.
I would suggest to patch SVG string in the _cleanSvg function:
1) add xmlns:xlink="http://www.w3.org/1999/xlink"
2) substitute href= for xlink:href=
Change History (6)
comment:3 Changed 9 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Your fix doesn't work for FF with gfxRenderer=canvas. In this case FF provides links with namespace xlink (xlink:href="someUrl"). But it doesn't provide xmlns:xlink definition.
The colon (:) is also considered as a border of a word for the \b regular expression. So we get xlink:xlink:href= after replacement.
My proposal is to substitute the line svg = svg.replace(/\bhref\s*=/g,"xlink:href="); with
if (svg.indexOf("xlink:href") == -1) svg = svg.replace(/href\s*=/g,"xlink:href=");
It would work than for Chrome&Safari, FF, Opera both for svg and canvas.
However there is general problem to export images under vml and silverlight. Export is performed without images. But export doesn't work at all with images
Additional information: From my tests, this problem only appears on Chrome and Safari. FF and IE9 are ok.