W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2012

Re: [WebIDL] Interface object prototype and function object

From: Ms2ger <ms2ger@gmail.com>
Date: Wed, 03 Oct 2012 17:54:15 +0200
Message-ID: <506C5FA7.9070508@gmail.com>
To: public-webapps@w3.org
Hi Philippe,

On 10/03/2012 05:43 PM, Philippe Le Hegaret wrote:
> In
>   http://dev.w3.org/2006/webapi/WebIDL/
> section 4.4.1 says: "The interface object for a given non-callback
> interface is a function object."
> section 4 says: "If an object is defined to be a function object, then
> it has characteristics as follows: Its [[Prototype]] internal property
> is the Function prototype object.[...]"
> Does this mean that:
>   typeof Document.prototype should return "function" ?
> If not, I'm wondering what I'm missing...

What you're missing is that obj.prototype doesn't return obj's 
[[Prototype]] internal property. You can get the [[Prototype]] internal 
property through Object.getPrototypeOf(obj) or obj.__proto__. In Gecko, 
at least,

w(typeof XMLHttpRequest)
w(typeof Object.getPrototypeOf(XMLHttpRequest))
w(typeof XMLHttpRequest.__proto__)

all print "function". (Using XMLHttpRequest because that's one of the 
few objects that use WebIDL-compliant bindings in Gecko.)

Received on Wednesday, 3 October 2012 15:54:51 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:49 UTC