I need to get data when a specific attribute is added . I have read this post : Is there a JavaScript/jQuery DOM change listener?
var observer = new MutationObserver(function (mutations, observer) {
// fired when a mutation occurs
$.each(mutations, function(index, mutation) {
var post = $(mutation.target).find('div[class^="ContentWrapper"]');
});
});
observer.observe(document, {
subtree: true,
attributes: true
});
There is a problem with this approach because there are to many events and the extension is very slow,is there an option to filter the mutations,by specific attribute?