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