I have the following code inside a chrome extension:
var observer = new MutationObserver(function (mutations) { mutations.forEach(function (mutation) { if (mutation.type === "childList") { Log.Debug("mutation: Childlist:"+mutation.addedNodes.length); forEach.call(mutation.addedNodes, function (addedNode) { if (addedNode.classList !== undefined) { if (addedNode.classList.contains('nja')) { Log.Debug("DOM PD:"+addedNode.classList); DoFancyStuff(addedNode); } } } }}); This happens on a site that adds content dynamically. (Google+). Everything works just perfect if the user scrolls down and just a few new elements are added.
If the user stays away from the browser for a while and clicks onto a button that causes a lot of new elements to be displayed, the MutationObserver seems to miss some nodes. I can verify this behavior inside the debug window. (A few of the added divs with the "nja"-class are written to the console, some aren't)
So for me it seems that this only works if there aren't too many divs added at once. Is there any configuration to change this behavior?
(Because this is a chrome extension I only need a solution for chrome not for any other browser)