appendChild = function(message) {
console.log(\"intercepted!\");
}
using the code above does not seem to work.
Anyone knows?
What you might want to replace is Element.prototype.appendChild
but it's probably a bad idea.
This example adds the text intercepted
in the inserted element :
var f = Element.prototype.appendChild;
Element.prototype.appendChild = function(){f.apply(this, arguments);arguments[0].innerHTML="!Intercepted!"; };
document.body.appendChild(document.createElement("div"));
Demonstration