javascript - JS restore default/global functions -


This is a fictional question, it is not really practical use, but ...

Value Take that you had to:

  document.open = null;   

How to restore a document. Opening its original functionality, is it possible (without temporary storage created by the user)? Is document.open stored in another place under a lower name? Thanks!

Overwriting a function called document.open Open document directly to the object However, the original function was not on the object, but its prototype - so that you can actually restore it.

open function is HTMLDocument.prototype so you can do this by HTMLDocument.prototype.open . You can access it by using it.

To call it directly, specify the object to use .call () on it:

  HTMLDocument.prototype. Open.call (document, ...); You can also restore  document.open  by simply specifying it:  
  document.open = HTMLDocument.prototype .open;   

However, remember that HTMLDocument and thus documents are hosted objects and usually a good idea to mess with them. There is no - especially if you do so IE things may be bad.

Comments