Optimize killSticky to only call getComputedStyle once per element
This commit is contained in:
parent
c8febe8c79
commit
6711ae5729
@ -60,8 +60,8 @@ function checkForShouldKillSticky(result) {
|
|||||||
function killSticky(root) {
|
function killSticky(root) {
|
||||||
root = root || document.querySelector("body");
|
root = root || document.querySelector("body");
|
||||||
root.querySelectorAll('*').forEach(element => {
|
root.querySelectorAll('*').forEach(element => {
|
||||||
if (getComputedStyle(element).position === 'fixed' ||
|
let position = getComputedStyle(element).position;
|
||||||
getComputedStyle(element).position === 'sticky') {
|
if (position === 'fixed' || position === 'sticky') {
|
||||||
// uBlock exception.
|
// uBlock exception.
|
||||||
if (element.tagName == "IFRAME" &&
|
if (element.tagName == "IFRAME" &&
|
||||||
element.parentElement.tagName == "HTML")
|
element.parentElement.tagName == "HTML")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user