Consider the following code:
var Widget = new Class({
Implements: [Options],
options: {
"name" : "BaseWidget"
},
initialize: function(options) {
alert("Options are: " + JSON.stringify(options)); //alerts "Options are: undefined"
this.setOptions(options);
alert("My options are: " + JSON.stringify(this.options)); //alerts "My options are: { 'name' : 'BaseWidget' }"
},
getName: function() {
return this.options.name;
}
});
var LayoutWidget = Widget.extend({
initialize: function() {
this.parent({ "name" : "Layout" });
}
});
alert(new LayoutWidget().getName()); //alerts "BaseWidget"
I am having difficulty in determining why the argument passed in the "this.parent()" call in "initialize" function of LayoutWidget is coming through as "undefined" in the initialize function of Widget.
I am using MooTools 1.2.2. Would somebody be able to point me in the right direction?