optimise addSelectedClass func

This commit is contained in:
Robin Scholtes 2023-05-12 17:58:56 +12:00
parent 8ece85127a
commit 8649b90a04

View file

@ -611,14 +611,7 @@ class RecipeWaiter {
* @param {string} opDataName the data-name of the target operation
*/
addSelectedClass(opDataName) {
const list = document.querySelectorAll(".operation");
const item = Array.from(list).filter((item) => item.getAttribute("data-name") === opDataName);
// when an item is listed in favourites, there are 2 of
// them and both need the 'selected' class ( checkmark )
item.forEach((op) => {
op.classList.add("selected");
});
document.querySelector(`.operation[data-name="${opDataName}"]`).classList.add("selected");
}
/**