We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4068bd8 commit bbdaa6aCopy full SHA for bbdaa6a
src/platform/platform.dom.js
@@ -95,11 +95,15 @@ function initCanvas(canvas, aspectRatio) {
95
const eventListenerOptions = supportsEventListenerOptions ? {passive: true} : false;
96
97
function addListener(node, type, listener) {
98
- node.addEventListener(type, listener, eventListenerOptions);
+ if (node) {
99
+ node.addEventListener(type, listener, eventListenerOptions);
100
+ }
101
}
102
103
function removeListener(chart, type, listener) {
- chart.canvas.removeEventListener(type, listener, eventListenerOptions);
104
+ if (chart && chart.canvas) {
105
+ chart.canvas.removeEventListener(type, listener, eventListenerOptions);
106
107
108
109
function fromNativeEvent(event, chart) {
0 commit comments