From 5621969a1e3a50c73c2ab7b28977e94a2a76c536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Tusz?= Date: Tue, 15 Dec 2015 18:19:19 -0500 Subject: [PATCH 1/2] Remove all event listeners from gd --- src/plot_api/plot_api.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plot_api/plot_api.js b/src/plot_api/plot_api.js index 42db83daa92..67cb17bfc17 100644 --- a/src/plot_api/plot_api.js +++ b/src/plot_api/plot_api.js @@ -941,6 +941,7 @@ Plotly.redraw = function(gd) { Plotly.newPlot = function (gd, data, layout, config) { gd = getGraphDiv(gd); plots.purge(gd); + gd.removeAllListeners(); return Plotly.plot(gd, data, layout, config); }; From 6e21c470f3435621ae37d7aafc3574b7bda205cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Tusz?= Date: Wed, 16 Dec 2015 09:53:26 -0500 Subject: [PATCH 2/2] Moved `removeAllListeners` and added existence check --- src/plot_api/plot_api.js | 1 - src/plots/plots.js | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plot_api/plot_api.js b/src/plot_api/plot_api.js index 67cb17bfc17..42db83daa92 100644 --- a/src/plot_api/plot_api.js +++ b/src/plot_api/plot_api.js @@ -941,7 +941,6 @@ Plotly.redraw = function(gd) { Plotly.newPlot = function (gd, data, layout, config) { gd = getGraphDiv(gd); plots.purge(gd); - gd.removeAllListeners(); return Plotly.plot(gd, data, layout, config); }; diff --git a/src/plots/plots.js b/src/plots/plots.js index f83e424769b..e215df324bf 100644 --- a/src/plots/plots.js +++ b/src/plots/plots.js @@ -712,6 +712,9 @@ plots.purge = function(gd) { delete gd.numboxes; delete gd._hoverTimer; delete gd._lastHoverTime; + + // remove all event listeners + if(gd.removeAllListeners) gd.removeAllListeners(); }; plots.style = function(gd) {