It is not recommended that you rewrite your own functions, but if you do, make sure you also return the added item to prevent problems with code that uses the return value of the appendChild native function:
window.callbackFunc = function(elem, args) { // write some logic here } window.f = Element.prototype.appendChild; Element.prototype.appendChild = function() { window.callbackFunc.call(this, arguments); return window.f.apply(this, arguments); };
user1319331
source share