Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The plugin only removed its event listeners if it could access the chart's canvas. However, Chart.js clears its canvas before notifying plugins, so this didn't work: https://github.com/chartjs/Chart.js/blob/v3.3.2/src/core/core.controller.js#L857 I noticed this when I destroyed and recreated a Chart.js object against the same HTML `<canvas>` element; the original chart's event handlers still fired and threw errors because the `getState` object had been removed and no longer had needed information. To address this, I'm now saving the event listener's target as a custom property on the event listener function; that way, `removeHandler` always knows exactly what the target is. I also noticed that `mouseUp` was calling `removeHandler` with incorrect parameters, so I fixed it.
- Loading branch information