refactor: Move container cleaning code to a separate function
This commit is contained in:
10
index.html
10
index.html
@@ -550,6 +550,12 @@
|
||||
fillCharacterRoster();
|
||||
};
|
||||
|
||||
const clearContainer = (cont) => {
|
||||
while (cont.firstChild) {
|
||||
cont.removeChild(cont.lastChild);
|
||||
}
|
||||
};
|
||||
|
||||
const fillCharacterRoster = () => {
|
||||
var characterIDs = Object.keys(characterRoster).toSorted((idA, idB) => {
|
||||
// Sort by campaign name first
|
||||
@@ -566,9 +572,7 @@
|
||||
|
||||
var placeHolder = inpCharacterRoster.options[0];
|
||||
|
||||
while (inpCharacterRoster.firstChild) {
|
||||
inpCharacterRoster.removeChild(inpCharacterRoster.lastChild);
|
||||
}
|
||||
clearContainer(inpCharacterRoster);
|
||||
|
||||
inpCharacterRoster.appendChild(placeHolder);
|
||||
|
||||
|
Reference in New Issue
Block a user