Re: Node's __proto__
Boris Zbarsky <[email protected]> Fri, 16 Mar 2012 15:30:31 -0400
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
On 3/16/12 3:15 PM, Eric J. Van der Velden wrote: > I understand for example that > Node.prototype.__proto__===Object.prototype, but although > uninteresting, I still would like to know what I should write on > the ... in Node.__proto__===....prototype. Per future specs, Node.__proto__ === Function.prototype, since Node is a Function object. In Gecko's current implementation, it depends. In the new DOM bindings, the interface object's proto should be Function.prototype. In the XPConnect bindings (which Node is at the moment, but hopefully not for much longer), I have no idea offhand. > Because Object is a function, Object.__proto__===Function.prototype. > So I thought: Function.__proto__===Function.prototype. I thought > Function in JavaScript similar to Object in Java. But it is not true. Function.__proto__ === Function.prototype, yes. Node is special, because it's actually a host object at the moment. > Also what do you mean by "each prototype has a flattened version of > all methods and properties it inherits"? That wasn't relevant to your question; it was about Node.prototype. -Boris