title: Simple mutation observer example in JavaScript doesn't work
body: <p>I try to add a <code>MutationObserver</code> in my web page to track changes in an image <code>src</code>, but that doesn't work. </p>
  
  <p>Here's the code used:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>setTimeout(function() {
    document.getElementById("img").src = "http://i.stack.imgur.com/aQsv7.jpg"
  }, 2000);
  
  var target = document.querySelector('#img');
  
  var observer = new MutationObserver(function(mutations) {
    mutations.forEach(function(mutation) {
      console.log(mutation.type);
    });
  });
  
  var config = {
    attributes: true,
    childList: false,
    characterData: false
  };
  
  observer.observe(target, config);
  observer.disconnect();</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;img src="http://i.stack.imgur.com/k7HT5.jpg" id="img" class="pic" height="100"&gt;</code></pre>
  </div>
  </div>
  </p>