From 856964b396c8bde253c551aa154b43d4593fc785 Mon Sep 17 00:00:00 2001 From: Joost Molenkamp Date: Fri, 29 Jul 2022 19:28:44 +0200 Subject: [PATCH] Remove resize helper object on table destruction --- features/pageResize/dataTables.pageResize.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/features/pageResize/dataTables.pageResize.js b/features/pageResize/dataTables.pageResize.js index 9ee8fe3..8bf24e6 100644 --- a/features/pageResize/dataTables.pageResize.js +++ b/features/pageResize/dataTables.pageResize.js @@ -83,6 +83,12 @@ var PageResize = function ( dt, pageResizeManualDelta ) host.css( 'position', 'relative' ); } + var onDestroy = function () { + dt.off('.pageResize', onDestroy); + this.s.obj && this.s.obj.remove(); + }.bind(this); + dt.on('destroy.pageResize', onDestroy); + this._attach(); this._size(); }; @@ -162,8 +168,10 @@ PageResize.prototype = { obj .appendTo( this.s.host ) - .attr( 'data', 'about:blank' ); - } + .attr( 'data', 'about:blank' ); + + this.s.obj = obj; + } };