fixed rm lvl's update legend bug

This commit is contained in:
realaravinth
2021-05-30 12:18:27 +05:30
parent f448f28d01
commit 2c5dbc7c5f
4 changed files with 9 additions and 4 deletions

View File

@@ -53,11 +53,12 @@ const updateLevelNumbersOnDOM = (id: number) => {
}
// rename legend
const legend = levelGroup.getElementsByTagName('legend')[0];
const legendText = document.createTextNode(`Level ${newLevel}`);
levelGroup.getElementsByTagName(
'legend',
)[0].appendChild(legendText);
const newLegend = document.createElement('legend');
newLegend.className = legend.className;
newLegend.appendChild(legendText);
legend.replaceWith(newLegend);
// rename labels
updateLabels(levelGroup, newLevel);