Commit a0be52b8 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix detached DOM tree when destory called - #866

parent f29b9714
...@@ -6480,11 +6480,18 @@ ...@@ -6480,11 +6480,18 @@
c3_chart_fn.destroy = function () { c3_chart_fn.destroy = function () {
var $$ = this.internal; var $$ = this.internal;
$$.data.targets = undefined;
$$.data.xs = {};
$$.selectChart.classed('c3', false).html("");
window.clearInterval($$.intervalForObserveInserted); window.clearInterval($$.intervalForObserveInserted);
window.onresize = null; window.onresize = null;
$$.selectChart.classed('c3', false).html("");
// MEMO: this is needed because the reference of some elements will not be released, then memory leak will happen.
Object.keys($$).forEach(function (key) {
$$[key] = null;
});
return null;
}; };
c3_chart_fn.tooltip = function () {}; c3_chart_fn.tooltip = function () {};
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -12,9 +12,16 @@ c3_chart_fn.flush = function () { ...@@ -12,9 +12,16 @@ c3_chart_fn.flush = function () {
c3_chart_fn.destroy = function () { c3_chart_fn.destroy = function () {
var $$ = this.internal; var $$ = this.internal;
$$.data.targets = undefined;
$$.data.xs = {};
$$.selectChart.classed('c3', false).html("");
window.clearInterval($$.intervalForObserveInserted); window.clearInterval($$.intervalForObserveInserted);
window.onresize = null; window.onresize = null;
$$.selectChart.classed('c3', false).html("");
// MEMO: this is needed because the reference of some elements will not be released, then memory leak will happen.
Object.keys($$).forEach(function (key) {
$$[key] = null;
});
return null;
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment