mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 04:09:08 +02:00
addListener and removeListener are only invoked on defined (and valid) values (#11685)
This commit is contained in:
parent
4068bd8c47
commit
bbdaa6a14b
@ -95,11 +95,15 @@ function initCanvas(canvas, aspectRatio) {
|
||||
const eventListenerOptions = supportsEventListenerOptions ? {passive: true} : false;
|
||||
|
||||
function addListener(node, type, listener) {
|
||||
node.addEventListener(type, listener, eventListenerOptions);
|
||||
if (node) {
|
||||
node.addEventListener(type, listener, eventListenerOptions);
|
||||
}
|
||||
}
|
||||
|
||||
function removeListener(chart, type, listener) {
|
||||
chart.canvas.removeEventListener(type, listener, eventListenerOptions);
|
||||
if (chart && chart.canvas) {
|
||||
chart.canvas.removeEventListener(type, listener, eventListenerOptions);
|
||||
}
|
||||
}
|
||||
|
||||
function fromNativeEvent(event, chart) {
|
||||
|
Loading…
Reference in New Issue
Block a user