Change: check style.sheet instead of getComputedStyle (#779)
This commit is contained in:
parent
da9178096b
commit
f4b1ea8a90
|
@ -139,15 +139,11 @@ const APPLY = (() => {
|
||||||
}}));
|
}}));
|
||||||
|
|
||||||
function checkStyleApplied() {
|
function checkStyleApplied() {
|
||||||
// FIXME: this is not reliable
|
|
||||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1579345
|
|
||||||
const style = document.createElement('style');
|
const style = document.createElement('style');
|
||||||
style.textContent = ':root{--stylus-applied:1}';
|
|
||||||
document.documentElement.appendChild(style);
|
document.documentElement.appendChild(style);
|
||||||
const applied = getComputedStyle(document.documentElement)
|
const applied = Boolean(style.sheet);
|
||||||
.getPropertyValue('--stylus-applied');
|
|
||||||
style.remove();
|
style.remove();
|
||||||
return Boolean(applied);
|
return applied;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const code = `(${scriptContent})(${JSON.stringify(EVENT_NAME)})`;
|
const code = `(${scriptContent})(${JSON.stringify(EVENT_NAME)})`;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user