【发布时间】:2021-07-21 17:30:30
【问题描述】:
如果在 highcharts 标题/文本中找不到图像的 src,我需要运行 img 的 onerror 函数。
但是,highcharts 不支持开箱即用的 img 的 onerror,我需要将其添加到安全列表中,如 in the docs 所述。
例如
title: {
useHTML:true,
text: '<img src="/A/NotFound/src.png" onerror="doSomething(this)" />Solar Employment Growth'
}
我已尝试将 AST 设置为允许该属性;
Highcharts.AST.allowedAttributes.push('onerror');
但是,正如fiddle 中所见,该函数没有运行。 我错过了什么吗?
【问题讨论】:
标签: javascript highcharts