From ec2519fa30e33cf2a57f1255aeb311741409e092 Mon Sep 17 00:00:00 2001 From: Mike Bogochow Date: Thu, 12 Mar 2020 14:44:40 -0400 Subject: [PATCH] Fix destroy function when using autoReflow with multiple tables (#454) --- src/jquery.floatThead.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/jquery.floatThead.js b/src/jquery.floatThead.js index aa3cc08..a6a0270 100644 --- a/src/jquery.floatThead.js +++ b/src/jquery.floatThead.js @@ -104,7 +104,7 @@ return that; })(); - var canObserveMutations = typeof MutationObserver !== 'undefined'; + var globalCanObserveMutations = typeof MutationObserver !== 'undefined'; //browser stuff @@ -260,8 +260,6 @@ return this; //no more crappy browser support. } - var mObs = null; //mutation observer lives in here if we can use it / make it - if(util.isFunction(isTableWidthBug)) { isTableWidthBug = isTableWidthBug(); } @@ -309,7 +307,8 @@ if(!$table.is('table')){ throw new Error('jQuery.floatThead must be run on a table element. ex: $("table").floatThead();'); } - canObserveMutations = opts.autoReflow && canObserveMutations; //option defaults to false! + var canObserveMutations = opts.autoReflow && globalCanObserveMutations; //option defaults to false! + var mObs = null; //mutation observer lives in here if we can use it / make it var $header = $table.children('thead:first'); var $tbody = $table.children('tbody:first'); if($header.length === 0 || $tbody.length === 0){