Skip to content

Commit

Permalink
Fixed issue #5567, wrong clipping of offline exported SVG in IE11/Edge.
Browse files Browse the repository at this point in the history
  • Loading branch information
oysteinmoseng authored and TorsteinHonsi committed Aug 16, 2016
1 parent 87d3802 commit 86c7431
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions js/modules/exporting.src.js
Expand Up @@ -206,12 +206,13 @@ extend(Chart.prototype, {
.replace(/isShadow="[^"]+"/g, '')
.replace(/symbolName="[^"]+"/g, '')
.replace(/jQuery[0-9]+="[^"]+"/g, '')
.replace(/url\(("|")(\S+)("|")\)/g, 'url($2)')
.replace(/url\([^#]+#/g, 'url(#')
.replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ')
.replace(/ (NS[0-9]+\:)?href=/g, ' xlink:href=') // #3567
.replace(/\n/, ' ')
// Any HTML added to the container after the SVG (#894)
.replace(/<\/svg>.*?$/, '</svg>')
.replace(/<\/svg>.*?$/, '</svg>')
// Batik doesn't support rgba fills and strokes (#3095)
.replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g, '$1="rgb($2)" $1-opacity="$3"')
/* This fails in IE < 8
Expand Down Expand Up @@ -263,7 +264,7 @@ extend(Chart.prototype, {
html,
options = merge(chart.options, additionalOptions), // copy the options and add extra options
allowHTML = options.exporting.allowHTML;


// IE compatibility hack for generating SVG content that it doesn't really understand
if (!doc.createElementNS) {
Expand Down Expand Up @@ -360,7 +361,7 @@ extend(Chart.prototype, {
html = '<foreignObject x="0" y="0" width="200" height="200">' +
'<body xmlns="http://www.w3.org/1999/xhtml">' +
html[1] +
'</body>' +
'</body>' +
'</foreignObject>';
svg = svg.replace('</svg>', html + '</svg>');
}
Expand Down Expand Up @@ -398,7 +399,7 @@ extend(Chart.prototype, {
* @param {Object} chartOptions Additional chart options for the SVG representation of the chart
*/
exportChart: function (options, chartOptions) {

var svg = this.getSVGForExport(options, chartOptions);

// merge the options
Expand Down

0 comments on commit 86c7431

Please sign in to comment.