var Shape = Class.create(new Element("div", {
"class": "shape"
}), {
//constructor of Shape
initialize: function () {
}
})
Shape class inherit from an instance of Element, all what I want to get to know is, how can I refer to this instance in constructor of Shape if I can?
Use this to refer to the Element
instance inside Shape
constructor:
this.constructor.prototype
Alternatively, you could do this (Since it doesn't make sense for a shape to inherit from element):
var Shape = (function() {
var elem = new Element("div", {
"class": "shape"
});
return Class.create({
initialize: function() {
//refer to elem here
}
});
})();