My idea is that if we have a process that would benefit from extending
Object.prototype, then we can do this during the time we are processing. Afterwards we simply remove the extensions and everything is back to normal.
Object.prototype.toHTML = htmlGenerationFunction;
This trick won't work on browsers that don't implement the
delete operator (IE3), and it's going to be a pain if
hasOwnProperty isn't supported either (Safari 1 and IE5.0). But if you're not supporting those browsers then you can consider this trick (test yours here).