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.
Obviously this doesn't work:
HTMLDivElement.prototype.constructor = function()
{
alert('div created!');
}
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.
EDIT: Maybe there is something we could do with Mozilla's watch/unwatch methods to watch for a change?