From 3ccdb555da27cdd5a28bddb9f6dc4db440a6ff05 Mon Sep 17 00:00:00 2001 From: Jeremy Schomery Date: Wed, 19 Jul 2017 17:37:32 +0430 Subject: [PATCH] no insertAdjacentHTML usage on CM theme switching --- edit/edit.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/edit/edit.js b/edit/edit.js index c33dcb36..b5da9147 100644 --- a/edit/edit.js +++ b/edit/edit.js @@ -315,15 +315,17 @@ function acmeEventListener(event) { break; } // avoid flicker: wait for the second stylesheet to load, then apply the theme - document.head.insertAdjacentHTML('beforeend', - ''); - (() => { - setTimeout(() => { - CodeMirror.setOption(option, value); - themeLink.remove(); - document.getElementById('cm-theme2').id = 'cm-theme'; - }, 100); - })(); + document.head.appendChild($element({ + tag: 'link', + id: 'cm-theme2', + rel: 'stylesheet', + href: url + })); + setTimeout(() => { + CodeMirror.setOption(option, value); + themeLink.remove(); + document.getElementById('cm-theme2').id = 'cm-theme'; + }, 100); return; } case 'autocompleteOnTyping':