Use MutationObserver to setup widgets that are added after the initial load
merlinfuchs opened this issue · 0 comments
merlinfuchs commented
Some customers had problems with widgets not loading correctly when they are dynamically added (e.g. in a modal). This is because we only call setup
once on page load. Usually a customer would use our JavaScript library to setup the widgets themselves, but this doesn't really make sense for wordpress.
To solve this we could use a MutationObserver
to listen for newly added HTML elements. I'm not sure about the performance if we are listening for DOM changes globally so there probably should be a way to turn it off in the settings.