Refactoring method that was previously injected with implement
- by ryber
Greetings,
I'm trying to override or extend the Element.show() and .hide() methods in mootools in order to add some WAI-Aria toggling. I was trying to use the Class.Refactor() method like this:
Element = Class.refactor(Element, {
show: function(displayString) {
result = this.previous(displayString);
// Do my thing
return result;
},
hide: function() {
result = this.previous();
// Do my thing
return result;
}
});
however, this is not working, previous is null and I think the reason is that Mootools injects those methods through Element.implement. So the methods are not native?
I have figured out how to completely replace .show and .hide but I would like to retain all of their existing functionality and just add to it. Any ideas?