问题
Some days ago, I asked a question , that was:
How could anyone return the default value to a predefined JavaScript object or function (like the object window.console, or the object-function document.getElementById) once it has been changed?
Posted here: Return the default value to a predefined javascript object
The solution wasn't enough, because the possibility to return the default value was based on creating an iframe object and insert it to the current DOM. But, we also have the possibility to override the functions that let the client-side insert nodes into the DOM, like document.appendChild, document.insertBefore, ... For example, the concrete circunstances that I would like to know if it is possible to return the default value to a predefeined javascript object, like "console", "window", or anyone, are these:
HTMLdocument.prototype.createElement = undefined;
HTMLdocument.prototype.createAttribute = undefined;
HTMLdocument.prototype.createComment = undefined;
HTMLdocument.prototype.createDocumentFragment = undefined;
HTMLdocument.prototype.createElement = undefined;
HTMLdocument.prototype.createTextNode = undefined;
Node.prototype.appendChild = undefined;
Node.prototype.cloneNode = undefined;
Node.prototype.insertBefore = undefined;
Node.prototype.removeChild = undefined;
Node.prototype.replaceChild = undefined;
I hope that now the question is concise enough. The final question I would really like to solve is: is there any code-context in which it is impossible to return the default value to a predefined javascript object like console, for example? All my questions go around this final one. Thank you!
来源:https://stackoverflow.com/questions/22986880/return-default-value-to-predefined-javascript-objects-in-concrete-circumstances