From ef51b54e54d7ab6e5db4e56fd1bb4a91b13f61b1 Mon Sep 17 00:00:00 2001 From: achmizs Date: Sun, 3 Feb 2019 14:06:17 -0500 Subject: [PATCH] Slightly improvement performance on some sites --- src/contentScript.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/contentScript.js b/src/contentScript.js index b16ce96..46c0f35 100644 --- a/src/contentScript.js +++ b/src/contentScript.js @@ -58,14 +58,13 @@ function checkForShouldKillSticky(result) { */ function startConstantVigilance() { var observer = new MutationObserver((mutationsList, observer) => { - var shouldKillSticky = false; for (var mutation of mutationsList) { if (getComputedStyle(mutation.target).position == 'fixed' || - getComputedStyle(mutation.target).position == 'sticky') - shouldKillSticky = true; + getComputedStyle(mutation.target).position == 'sticky') { + mutation.target.remove(); + console.log("Killing new sticky!"); + } } - if (shouldKillSticky) - requestAnimationFrame(() => { killSticky(); }); }); observer.observe(document.querySelector("body"), {