I would like to connect to the Node constructor function. Is it possible to overwrite the public Node constructor with my own Node constructor?
Currently only testing in chrome / firefox
(function() { var _Node = window.Node; var Node = function() { Event.trigger("nodeCreation", this, arguments); // pseudocode _Node.apply(this, arguments); } window.Node = Node; console.log(document.createElement("div") instanceof _Node); // true console.log(document.createElement("div") instanceof Node); // false }());
I understand perfectly how dangerous it is if I am mistaken. I also know that this is very universal, if I can fix it.
Is there any other way to overwrite my own DOM objects. Extending your prototype is not useful for rewriting a constructor
Raynos
source share