title: A way to override the constructor on HTMLElement so I can add custom code
body: <p>I'm trying to somehow override the constructor of HTMLElement (specifically HTMLDivElement), so that whenever any are created by whatever means, I can run some custom logic.</p>
  
  <p>Obviously this doesn't work:</p>
  
  <p><code><pre>
  HTMLDivElement.prototype.constructor = function()
  {
    alert('div created!');
  }
  </pre></code></p>
  
  <p>Is there a way to pull this off? Even if there was a way to get some sort of event/trigger when new elements where created (ones not part of the page's source HTML), that would be helpful.</p>
  
  <p>EDIT: Maybe there is something we could do with Mozilla's watch/unwatch methods to watch for a change?</p>