From ca1e5396d99d59234fd219aaff85ff46d1f12cd7 Mon Sep 17 00:00:00 2001 From: Joost Molenkamp Date: Tue, 6 Sep 2022 21:42:50 +0200 Subject: [PATCH] ScrollResize: remove draw event handler on table destruction --- features/scrollResize/dataTables.scrollResize.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/features/scrollResize/dataTables.scrollResize.js b/features/scrollResize/dataTables.scrollResize.js index 4a01d204..7daeedd5 100644 --- a/features/scrollResize/dataTables.scrollResize.js +++ b/features/scrollResize/dataTables.scrollResize.js @@ -79,15 +79,14 @@ var ScrollResize = function ( dt ) host.css( 'position', 'relative' ); } - dt.on( 'draw', function () { + dt.on( 'draw.scrollResize', function () { that._size(); } ); - var onDestroy = function () { - dt.off('.pageResize', onDestroy); + dt.on('destroy.scrollResize', function () { + dt.off('.scrollResize'); this.s.obj && this.s.obj.remove(); - }.bind(this); - dt.on('destroy.pageResize', onDestroy); + }.bind(this)); this._attach(); this._size();