const targetElement = document.querySelector(".player-selector");
const observer = new MutationObserver((mutations) => {
mutations.forEach(({ target: t }) => {
t.classList.contains("is-finished") ?
alert("element contains class") :
alert("element does not contain a class");
})
});
observer.observe(targetElement, {
attributes: true,
attributeFilter: ['class']
});