FF: preserve sheet's disabled state in workaround for #461

This commit is contained in:
tophf 2018-09-11 17:39:43 +03:00
parent 3243e37fbc
commit 6fdc01201b

View File

@ -333,11 +333,12 @@
(document.head || ROOT).appendChild(document.createElement('script')).text = `
document.currentScript.remove();
for (const {id, code} of ${JSON.stringify(pageContextQueue)}) {
(
document.getElementById(id) ||
document.querySelector('style.stylus[id="' + id + '"]') ||
{}
).textContent = code;
const el = document.getElementById(id) ||
document.querySelector('style.stylus[id="' + id + '"]');
if (!el) continue;
const {disabled} = el.sheet;
el.textContent = code;
el.sheet.disabled = disabled;
}
`;
} catch (e) {}