From 7bc0ec873168013498646744cdf7eb2cc8feb0b9 Mon Sep 17 00:00:00 2001 From: yoyurec Date: Fri, 21 Oct 2022 10:47:18 +0300 Subject: [PATCH] fix(pageicon): checking oldicon --- src/modules/pageIcons/pageIcons.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/modules/pageIcons/pageIcons.ts b/src/modules/pageIcons/pageIcons.ts index b5a81cd..d2e28f2 100644 --- a/src/modules/pageIcons/pageIcons.ts +++ b/src/modules/pageIcons/pageIcons.ts @@ -139,12 +139,13 @@ export const setStyleToLinkItem = async (linkItem: HTMLElement, pageProps: props const pageIcon = pageProps['icon']; if (pageIcon && pageIcon !== 'none') { const oldPageIcon = linkItem.querySelector('.awLi-icon'); - if (!oldPageIcon) { - linkItem.insertAdjacentHTML('afterbegin', `${pageIcon}`); - } else { - if (oldPageIcon.textContent !== pageIcon) { - oldPageIcon.textContent = pageIcon; + if (oldPageIcon) { + if (oldPageIcon.innerHTML !== pageIcon) { + linkItem.insertAdjacentHTML('afterbegin', `${pageIcon}`); + oldPageIcon.remove(); } + } else { + linkItem.insertAdjacentHTML('afterbegin', `${pageIcon}`); } } // color