Expected behaviour
When useHTML: true, a legend label whose HTML has a < symbol inside an attribute value produces valid SVG when exported.
Actual behaviour
The < symbol is not escaped on the exported SVG. Instead, it appears as a literal character within an SVG attribute value.
Live demo with steps to reproduce
https://jsfiddle.net/y7vtpzb4/2
- Add the
exporting module:
<script src="https://code.highcharts.com/modules/exporting.js"></script>
- Write JS code:
Highcharts.chart('container', {
legend: {
useHTML: true,
labelFormatter: () => `<span title="<">hover on me</span>`,
},
series: [{
data: [[1, 1]]
}]
});
- Click the button at the corner of the chart and export to an SVG file
- Open the SVG file in an editor and observe invalid XML:
error on line 1 at column 4222: Unescaped '<' not allowed in attributes values
Product version
Highcharts 10.1.0, 10.2.1
Affected browser(s)
Google Chrome on Windows version 105.0.5195.127
Safari on Mac OS version 15.6.1 (17613.3.9.1.16)
Expected behaviour
When
useHTML: true, a legend label whose HTML has a<symbol inside an attribute value produces valid SVG when exported.Actual behaviour
The
<symbol is not escaped on the exported SVG. Instead, it appears as a literal character within an SVG attribute value.Live demo with steps to reproduce
https://jsfiddle.net/y7vtpzb4/2
exportingmodule:<script src="https://code.highcharts.com/modules/exporting.js"></script>Product version
Highcharts 10.1.0, 10.2.1
Affected browser(s)
Google Chrome on Windows version 105.0.5195.127
Safari on Mac OS version 15.6.1 (17613.3.9.1.16)