var settingsObserver = new MutationObserver(function(mutationRecords) {
// do stuff, this is triggered whenever the class of the settings tab is changed }); selectionObserver.observe(document.getElementById('#sidepanel-prefs').parentNode, { attributes: true, attributeFilter: ['class'] });