Skip to content

Commit

Permalink
Fixed #7126, less than sign followed by a space was interpreted as ma…
Browse files Browse the repository at this point in the history
…rkup.
  • Loading branch information
TorsteinHonsi committed Sep 11, 2017
1 parent fbbf3a7 commit 10103d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion js/parts/SvgRenderer.js
Expand Up @@ -2392,7 +2392,10 @@ extend(SVGRenderer.prototype, /** @lends Highcharts.SVGRenderer.prototype */ {
/*= } =*/
}

span = unescapeEntities(span.replace(/<(.|\n)*?>/g, '') || ' ');
// Strip away unsupported HTML tags (#7126)
span = unescapeEntities(
span.replace(/<[a-zA-Z](.|\n)*?>/g, '') || ' '
);

// Nested tags aren't supported, and cause crash in Safari (#1596)
if (span !== ' ') {
Expand Down
7 changes: 7 additions & 0 deletions samples/unit-tests/svgrenderer/text/demo.js
Expand Up @@ -146,4 +146,11 @@ QUnit.test('HTML entities', function (assert) {
'Hello & <tag>',
'HTML entities decoded correctly'
);

text = ren.text('a < b and c > d', 10, 60).add();
assert.strictEqual(
text.element.textContent,
'a < b and c > d',
'Tags don\'t start with spaces (#7126)'
);
});

0 comments on commit 10103d6

Please sign in to comment.