How to get this.grandparent() functionality in Mootools?
- by RyOnLife
I have built a class in Mootools and extended it twice, such that there is a grandparent, parent, and child relationship:
var SomeClass1 = new Class({
initialize: function() {
// Code
},
doSomething: function() {
// Code
}
});
var SomeClass2 = new Class({
Extends: SomeClass1,
initialize: function() {
this.parent();
},
doSomething: function() {
this.parent();
// Some code I don't want to run from Class3
}
});
var SomeClass3 = new Class({
Extends: SomeClass2,
initialize: function() {
this.parent();
},
doSomething: function() {
this.grandParent();
}
});
From Class3, the child, I need call the doSomething() method from Class1, the grandparent, without executing any code in Class2#doSomething(), the parent.
What I need is a grandParent() method to complement the Mootools parent(), but it appears that one does not exist.
What's the best way to accomplish this in either Mootools or pure JavaScript? Thanks.