Open msjgriffiths opened 10 years ago
It doesn't work for any external elements. The following example works in chrome (image is pulled and shown) but it shows ugly missing image icon when downloaded.
<svg width="796" height="455" viewBox="0 0 700 400" perserveaspectratio="xMinYMid" version="1.1" xmlns="http://www.w3.org/2000/svg">
<image x="0" y="0" width="700" height="400" opacity="0.5" type="image/svg+xml" xlink:href="/static/data/plan.svg"></image>
</svg>
This works great!
If there are multiple SVG documents on a page, and one contains a node that can be used as a fill in CSS, the scripts does not pull that into the output.
For example, consider this example, which uses D3 to load a shapefile and create a world map. CSS and a SVG element in the page HTML are applied to style the dynamically created SVG element.
http://becausedata.com/tmp/svg-crowbar/radial-gradiant/
The browser will apply the radialGradient directly, but it will not be merged into the downloaded SVG document (unsurprisingly).
The easiest workaround is to include the contents of the second SVG element inside the dynamically created one, e.g. via .appendChild() after load. In general, this works pretty well, but it does require an extra step.