no insertAdjacentHTML usage on CM theme switching

This commit is contained in:
Jeremy Schomery 2017-07-19 17:37:32 +04:30 committed by tophf
parent 9870a8041c
commit 3ccdb555da

View File

@ -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',
'<link id="cm-theme2" rel="stylesheet" href="' + url + '">');
(() => {
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':