Monitor for changes in the ClassList of an Element
You can capture changes to the class list with event.detail.oldClassList and compare with the current element values in element.classList. Only bind this Event to the elements that require monitoring.
document.getElementById("element_to_monitor").addEventListener("ClassListChanged", function(event){ console.log("newClassList", event.target.classList, "oldClassList", event.detail.oldClassList); });
npm i dom_token_list-functions-class_list_monitor
window.classListMonitor = require('dom_token_list-functions-class_list_monitor');
You can stop the monitoring process with
window.classListMonitor.destroy();