From e311ee1f05f3a6e0128319658cd24b6337b85719 Mon Sep 17 00:00:00 2001 From: Nikolay Spassov Date: Thu, 29 Sep 2022 21:56:25 +0300 Subject: [PATCH] Update element selector query Selecting only direct descendants of body seems to work better for me --- src/kill-sticky.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kill-sticky.js b/src/kill-sticky.js index 8c8d005..c2d6a28 100644 --- a/src/kill-sticky.js +++ b/src/kill-sticky.js @@ -1,12 +1,12 @@ (function () { - document.querySelectorAll('body *').forEach(function(node) { + document.querySelectorAll('body > *').forEach(function(node) { if (['fixed', 'sticky'].includes(getComputedStyle(node).position)) { node.parentNode.removeChild(node); } }); - document.querySelectorAll('html *').forEach(function(node) { + document.querySelectorAll('body > *').forEach(function(node) { var s = getComputedStyle(node); if ('hidden' === s['overflow']) { node.style['overflow'] = 'visible'; } if ('hidden' === s['overflow-x']) { node.style['overflow-x'] = 'visible'; }