title: MutationObserver class changes
body: <p>I am using <code>MutationObserver</code> to detect when a specific class has been added to an element. </p>
  
  <pre><code>const observer = new MutationObserver((mutations) =&gt; { 
      mutations.forEach((mutation) =&gt; {
        const el = mutation.target;
        if ((!mutation.oldValue || !mutation.oldValue.match(/\bis-busy\b/)) 
          &amp;&amp; mutation.target.classList 
          &amp;&amp; mutation.target.classList.contains('is-busy')){
          alert('is-busy class added');
        }
      });
   });
  
  observer.observe(document.querySelector('div'), { 
    attributes: true, 
    attributeOldValue: true, 
    attributeFilter: ['class'] 
  });
  </code></pre>
  
  <p>My question is: <strong>Is there a better way to verify that this is a newly added class?</strong> Currently I am using regex to check that the class didn't exist previously and <code>classList</code> to check that the class exists now. Seems messy</p>
  
  <p><a href="https://jsfiddle.net/s53o8dLe/12/" rel="noreferrer">Fiddle</a></p>