From 108907d4f1dbde8ac487f96c0608144b70769acc Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 12 Feb 2020 19:44:25 +0300 Subject: [PATCH] skip transition-patch in invisible tabs (#851) --- content/style-injector.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/content/style-injector.js b/content/style-injector.js index 1b496b4c..96755c73 100644 --- a/content/style-injector.js +++ b/content/style-injector.js @@ -107,10 +107,12 @@ self.createStyleInjector = self.INJECTED === 1 ? self.createStyleInjector : ({ } function _applyTransitionPatch(styles) { + isTransitionPatched = true; // CSS transition bug workaround: since we insert styles asynchronously, // the browsers, especially Firefox, may apply all transitions on page load - isTransitionPatched = document.readyState === 'complete'; - if (isTransitionPatched || !styles.some(s => s.code.includes('transition'))) { + if (document.readyState === 'complete' || + document.visibilityState === 'hidden' || + !styles.some(s => s.code.includes('transition'))) { return; } const el = _createStyle(PATCH_ID, `