I've below code to observe a modal, but it doesn't seem to work
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if(mutation) { console.log('appeared') }
})
})
var node = document.querySelector('[class^="selection-menu-container"]')
observer.observe(node, {childList: true, substree: true})
Any clue what's missing? When I do console.log(node) I can see it is targeting the modal. Note that the selection-menu-container class isn't available on the DOM on first load, can that be the cause of the issue?