Highcharts Demo
author(s): Torstein Hønsi
by Black Label
HTML
<script src="https://code.highcharts.com/13.0.2/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
JavaScript
// Workaround fix for all affected Highcharts versions: 12.0.0-13.0.2
((n)=>{n.AST.prototype.parseMarkup=function parseMarkup(t){let e,i=[];t=t.trim().replace(/ style=(["'])/g," data-style=$1");try{e=new DOMParser().parseFromString(tI?tI.createHTML(t):t,"text/html")}catch{}if(!e)try{e=new DOMParser().parseFromString(t,"text/html")}catch{}e||((e=n.doc.implementation.createHTMLDocument("")).body.innerHTML=t);let s=(t,e)=>{let i=t.localName||t.nodeName.toLowerCase(),o={tagName:i};"#text"===i&&(o.textContent=t.textContent||"");let r=t.attributes;if(r){let t={};[].forEach.call(r,e=>{"data-style"===e.name?o.style=tB.parseStyle(e.value):t[e.name]=e.value}),o.attributes=t}if(t.childNodes.length){let e=[];[].forEach.call(t.childNodes,t=>{s(t,e)}),e.length&&(o.children=e)}e.push(o)};return[].forEach.call(e.body.childNodes,t=>s(t,i)),i};})(Highcharts);
// End of the workaround fix
var originalParseFromString = DOMParser.prototype.parseFromString;
var originalCreateElement = document.createElement;
var originalCreateHTMLDocument = document.implementation.createHTMLDocument;
var liveDivCreated = false;
var inertDocumentCreated = false;
DOMParser.prototype.parseFromString = function () {
throw new Error('Simulated DOMParser failure');
};
document.createElement = function (tagName) {
if (String(tagName).toLowerCase() === 'div') {
liveDivCreated = true;
}
return originalCreateElement.apply(this, arguments);
};
document.implementation.createHTMLDocument = function () {
inertDocumentCreated = true;
return originalCreateHTMLDocument.apply(this, arguments);
};
new Highcharts.AST('<img src="x">');
DOMParser.prototype.parseFromString = originalParseFromString;
document.createElement = originalCreateElement;
document.implementation.createHTMLDocument = originalCreateHTMLDocument;
var passed = inertDocumentCreated && !liveDivCreated;
Highcharts.chart('container', {
title: {
text: 'Highcharts ' +...