From f4b1ea8a90df37071a7245d4dbae39814b81415c Mon Sep 17 00:00:00 2001 From: eight Date: Wed, 11 Sep 2019 15:32:34 +0800 Subject: [PATCH] Change: check style.sheet instead of getComputedStyle (#779) --- content/apply.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/content/apply.js b/content/apply.js index ded671d1..89c3a540 100644 --- a/content/apply.js +++ b/content/apply.js @@ -139,15 +139,11 @@ const APPLY = (() => { }})); function checkStyleApplied() { - // FIXME: this is not reliable - // https://bugzilla.mozilla.org/show_bug.cgi?id=1579345 const style = document.createElement('style'); - style.textContent = ':root{--stylus-applied:1}'; document.documentElement.appendChild(style); - const applied = getComputedStyle(document.documentElement) - .getPropertyValue('--stylus-applied'); + const applied = Boolean(style.sheet); style.remove(); - return Boolean(applied); + return applied; } }; const code = `(${scriptContent})(${JSON.stringify(EVENT_NAME)})`;