I exist, and all that is not-I is mere phenomenon dissolving into phenomenal connectionsEdmund Husserl
Relates to DOM Scripting
Further to my post regarding referencing the current object as an instance of its prototype (aka superclass) via super simulation, I have realised by maintaining the correct constructor property value in the object's prototype there is no need to pass the object constructor to the parent prototype method of Object.
Object.prototype.parent = function() {
var p = new Object();
for (x in this.constructor.prototype) {
if (x != "parent") {
p[x.toString()] = this[x.toString()];
}
}
return p;
}
function BoxContainer(param) {
Container.call(this, param);
var parent = this.parent();
[..snip..]
}
BoxContainer.prototype = new Container;
BoxContainer.prototype.constructor = BoxContainer;
Where the last line is critical, since the value of constructor is initially overriden with the assignment of the BoxContainer prototype to reference Container.
Posted on Wednesday, Oct 13, 2004 at 02:30:21.
Comments on Parent Prototype Revisited (0)