Return default value to predefined javascript objects in concrete circumstances

时光怂恿深爱的人放手 提交于 2019-12-25 06:35:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!