title: Implementation of a DOM listener
body: <p>I was thinking there was no DOM listener so I implemented my own 'heavy' listener:</p>
  
  <pre><code>function CvHelper(stackApi) {
    var that = this;
  
    // check if room is finished loading
    this.init = function() {
      if ($('#loading').length) {
        setTimeout(that.init, 1000);
      } else {
        console.log('Chatroom finished loading');
  
        that.postListener();
      }
    }
  }
  
  (function() {
    var stackApi = new StackApi();
    var cvHelper = new CvHelper(stackApi);
    cvHelper.init();
  })();
  </code></pre>
  
  <p>I think this just sucks. So I did a search on here on SO and <a href="https://stackoverflow.com/questions/2844565/is-there-a-jquery-dom-change-listener">this question</a> popped up. However the <a href="https://stackoverflow.com/questions/2844565/is-there-a-jquery-dom-change-listener#answer-2844704">last comment on the accepted question</a> states that it is deprecated.</p>
  
  <pre><code>$("#someDiv").bind("DOMSubtreeModified", function() {
    alert("tree changed");
  });
  </code></pre>
  
  <blockquote>
    <p><a href="http://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMSubtreeModified" rel="nofollow noreferrer">w3.org/TR/DOM-Level-3-Events/#event-type-DOMSubtreeModified</a> says this event is deprecated, what would we use instead?</p>
  </blockquote>
  
  <p>Is there a substition for it?<br>
  P.S. It only has to work on Chrome, because it is an Chrome extension.</p>