From 35d7406214e39fa5ad5c73cfab3eecb0eb7c8b7f Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 3 Jul 2021 09:19:24 -0400 Subject: [PATCH] Add `asap` behavior to `remove-attr` scriptlet Related issue: - https://github.com/uBlockOrigin/uAssets/issues/9528 --- assets/resources/scriptlets.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/assets/resources/scriptlets.js b/assets/resources/scriptlets.js index df51b0d72006e..2ff7795d6efb2 100644 --- a/assets/resources/scriptlets.js +++ b/assets/resources/scriptlets.js @@ -731,7 +731,7 @@ } } if ( skip ) { return; } - timer = self.requestIdleCallback(rmattr, { timeout: 67 }); + timer = self.requestIdleCallback(rmattr, { timeout: 17 }); }; const start = ( ) => { rmattr(); @@ -746,10 +746,10 @@ }; if ( document.readyState !== 'complete' && /\bcomplete\b/.test(behavior) ) { self.addEventListener('load', start, { once: true }); - } else if ( document.readyState === 'loading' ) { - self.addEventListener('DOMContentLoaded', start, { once: true }); - } else { + } else if ( document.readyState !== 'loading' || /\basap\b/.test(behavior) ) { start(); + } else { + self.addEventListener('DOMContentLoaded', start, { once: true }); } })(); @@ -1511,7 +1511,6 @@ - // These lines below are skipped by the resource parser. // <<<< end of private namespace })();