title: Mutation observer - DOM is changed by callback function
body: <p>is there a way, how to force mutation observer to ignore DOM changes cause by callback function?</p>
  
  <p>Right now I have:</p>
  
  <pre><code>var config = { attributes: true, childList: true, characterData: true };
  var target = document.body;
  var timer;
  
  // create an observer instance
  var observer = new MutationObserver(function(mutations) {
  
     // fired when a mutation occurs
     timer = setTimeout(function () {
  
        _3rd_party_callback();
  
  
     }, 500);  
  
  });
  
  observer.observe(target, config);
  </code></pre>
  
  <p>Problem is that,  <code>_3rd_party_callback</code> callback cause DOM change, so it never stops. As its names says, It's third party function and I can't change (actually its DOM manipulating is its purpose).</p>
  
  <p>So what I do is to disconnect and start observer before and after the function is called in callback, respectively.</p>
  
  <pre><code>  observer.disconnect()
    _3rd_party_callback();
    observer.observe(target, config);
  </code></pre>
  
  <p>It seems to work, but I'm afraid, that thanks to asynchronous handeling of the event I might have observer disabled, when others changes are made and miss them.</p>
  
  <p>It's quite unlikely that there's a way to separate changes from page itself and the callback, but I'll give it a try.</p>