Skip to content

Commit

Permalink
fix(pageicon): checking oldicon
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyurec committed Oct 21, 2022
1 parent eec5d62 commit 7bc0ec8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/modules/pageIcons/pageIcons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', `<span class="awLi-icon">${pageIcon}</span>`);
} else {
if (oldPageIcon.textContent !== pageIcon) {
oldPageIcon.textContent = pageIcon;
if (oldPageIcon) {
if (oldPageIcon.innerHTML !== pageIcon) {
linkItem.insertAdjacentHTML('afterbegin', `<span class="awLi-icon">${pageIcon}</span>`);
oldPageIcon.remove();
}
} else {
linkItem.insertAdjacentHTML('afterbegin', `<span class="awLi-icon">${pageIcon}</span>`);
}
}
// color
Expand Down

0 comments on commit 7bc0ec8

Please sign in to comment.