using this instead of re-selecting element

This commit is contained in:
Andrew 2019-04-21 00:43:07 -05:00 committed by GitHub
parent fb9cf148e8
commit 7432e07e98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -107,10 +107,7 @@ function applyBackground(data: BackgroundData, list: Background[]) {
link.onload = () => {
var selector = this.getAttribute('href');
if (selector) selector = selector.split(/(light|dark|transp)/)[2];
setTimeout(() => {
var prevLink = document.querySelector("link[href$=\'light"+selector+"\'], link[href$=\'dark"+selector+"\'], link[href$=\'transp"+selector+"\']");
if (prevLink) prevLink.remove();
}, 100);
setTimeout(() => this.remove(), 100);
}
document.head.appendChild(link);
});