On 12/6/05, Adam Judson <[EMAIL PROTECTED]> wrote: > Now can you explain why... > A.prototype.prototype A.prototype is an object literal. Objects dont' have prototypes, only functions can.
> A.prototype.constructor.prototype A.prototype is an object literal. It's constructor is Object. So A.prototype.constructor.prototype.foo = bar is the same as Object.prototype.foo = bar, which should actually do something, but probably not what you want. This will affect every single object in mozilla, not just the ones which are instances of A. I think there may be a bug in Mozilla about following the constructor path though, which prevents this from working. You just need to remember that "prototype" is for constructors. The value of the prototype goes into __proto__ in the objects that the constructor creates. __proto__ is the actual lookup chain, not prototype. So when you do a.b, b is checked for on a, then a.__proto__.b, then a.__proto__.__proto__.b, and so on. Prototype has nothing to do with this, except for the fact that in the ECMA spec, it is the only way to set __proto__. In Mozilla, __proto__ is exposed directly, so you don't really even need prototype. - a _______________________________________________ Project_owners mailing list [email protected] http://mozdev.org/mailman/listinfo/project_owners
