In YUI3 is it possible to overwrite a method from e.g. the Node
module? For example, I want to do something like this:
Y.Node.prototype.get = function () {
// Do some stuff then call the original function
};
That works perfectly (as you would expect) when Y
is the globally available instance of YUI that I presume is created by the library. It does not work when you use the module loader and pass a callback:
YUI().use("*", function (DifferentY) {
DifferentY.Node.prototype.get === Y.Node.prototype.get; // false
});
I've spent a while digging through the YUI source but have so far failed to work out where and how DifferentY
in the previous example is created (and by extension, where DifferentY.Node
is created).
I have never used YUI before so it may be that I'm going about this in the completely wrong way.