Merge remote-tracking branch 'upstream/master'

* upstream/master:
  code cosmetics: convert to a lintable template string
  FF: preserve sheet's disabled state in workaround for #461
This commit is contained in:
dana 2018-09-11 17:23:48 -07:00
commit a31162cc16

View File

@ -330,16 +330,17 @@
function setContentsInPageContext() { function setContentsInPageContext() {
try { try {
(document.head || ROOT).appendChild(document.createElement('script')).text = ` (document.head || ROOT).appendChild(document.createElement('script')).text = `(${queue => {
document.currentScript.remove(); document.currentScript.remove();
for (const {id, code} of ${JSON.stringify(pageContextQueue)}) { for (const {id, code} of queue) {
( 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;
} }
`; }})(${JSON.stringify(pageContextQueue)})`;
} catch (e) {} } catch (e) {}
let failedSome; let failedSome;
for (const {el, code} of pageContextQueue) { for (const {el, code} of pageContextQueue) {