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