Преглед на файлове

Optimize killSticky to only call getComputedStyle once per element

master
saturn преди 6 години
родител
ревизия
6711ae5729
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 3
    3
      src/contentScript.js

+ 3
- 3
src/contentScript.js Целия файл

@@ -60,8 +60,8 @@ function checkForShouldKillSticky(result) {
function killSticky(root) {
root = root || document.querySelector("body");
root.querySelectorAll('*').forEach(element => {
if (getComputedStyle(element).position === 'fixed' ||
getComputedStyle(element).position === 'sticky') {
let position = getComputedStyle(element).position;
if (position === 'fixed' || position === 'sticky') {
// uBlock exception.
if (element.tagName == "IFRAME" &&
element.parentElement.tagName == "HTML")
@@ -139,4 +139,4 @@ function initialize() {
}
});
}
initialize();
initialize();

Loading…
Отказ
Запис