Re: Node's __proto__
"Eric J. Van der Velden" <[email protected]> Fri, 16 Mar 2012 12:15:09 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
On Mar 12, 7:00=A0am, Bobby Holley <[email protected]> wrote: > Hi Eric, > > |Node| and |Element| are both constructor objects. They both have the same > proto, and it's very uninteresting (the proto of that object is > Object.prototype). > > Things like |Node| and |Element| are just kind of waystations on the way = to > things like Node.prototype and Element.prototype. Those are the __proto__s > for actual Node and Element instances, and they form a nice inheritance > hierarchy (ie: Element.prototype.__proto__ =3D=3D=3D Node.prototype). > > But we also do a lot of that stuff wrong in Gecko, as it stands. For > example, each prototype has a flattened version of all methods and > properties it inherits. But we're fixing this all soon. > > Cheers, > bholley > > On Sun, Mar 11, 2012 at 6:49 AM, Eric J. Van der Velden < > > > > > > > > [email protected]> wrote: > > Hello, > > > What is Node.__proto__ , or Element.__proto__ ? > > > Thanks > > > Eric J. > > _______________________________________________ > > dev-tech-dom mailing list > > [email protected] > >https://lists.mozilla.org/listinfo/dev-tech-dom Hi Bobby, Thank you very much for taking the effort to explain this to me. I understand for example that Node.prototype.__proto__=3D=3D=3DObject.prototype, but although uninteresting, I still would like to know what I should write on the ... in Node.__proto__=3D=3D=3D....prototype. I'll tell you why. I thought I had it all figured out, but it apparently is not true. Because Object is a function, Object.__proto__=3D=3D=3DFunction.prototype. So I thought: Function.__proto__=3D=3D=3DFunction.prototype. I thought Function in JavaScript similar to Object in Java. But it is not true. So what is Function.__proto__, Node.__proto__, ...? Also what do you mean by "each prototype has a flattened version of all methods and properties it inherits"? Thanks, Eric J.