On Aug 12, 2014, at 9:44 AM, Garrett Smith wrote:

> What's the explanation and reason for this strange characteristic of
> the OBJECT element in Firefox?
> 
> Firefox 31:
> typeof document.createElement("object")
> "function"
> Function.prototype.toString.call(document.createElement("object"));
> TypeError: Function.prototype.toString called on incompatible object
> 
> If the typeof OBJECT results "function" then it either:
> a) implements [[Call]] or
> b) is exotic
> 
> Since calling `Function.prototype.toString` with OBJECT as the this
> value results in a TypeError, it appears that the OBJECT does not
> implement [[Call]] and thus the only explanation is that the OBJECT is
> exotic. Did I get that right? Or is there another explanation?
> 
> What's the explanation and reason for this strange characteristic of
> the OBJECT element in Firefox?

I don't see any where in your test where you [[Call]] OBJECT.

You [[Call]] Function.prototype.toString with OBJECT passed as the this value.

The ES5 spec. clearly says that F.p.toString is called with a this value that 
is not a "Function object".  Note this usage of "Function object"
 means an actual instance of the built-in Function constructor and not the more 
general, any object that isCallable.

So, this is exactly the behavior I would expect if OBJECT is some sort of 
exotic callable that is not actually an instance of Function.

Allen

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to