Re: [Constructor] and [NamedConstructor]

On Aug 22, 2011, at 8:31 PM, Cameron McCormack wrote:

> Does that mean you consider this native JS function not to be a "true constructor":
>  function F() {
>    return { };
>  }
> ?  Although with some implementations it might be less efficient to use new to invoke these constructors, I don't think it's going to be significant.  Implementations could well optimise these cases anyway. I'm not sure these notes would be useful.

All the finest ;-) optimizing JS VMs avoid making a new Object instance for new F.

>> 3) 4.5.2 doesn't say anything about the prototype property of a named
>> constructor function. Shouldn't it have one, and shouldn't it have the
>> same value as the prototype property of the interface object? (Note that
>> FF and Chrome do not do this for Image(), but Safari does)
> Safari/IEPP: Image.prototype == HTMLImageElement.prototype
> Chrome: Image.prototype.[[Prototype]] == HTMLImageElement
> Firefox: Image.prototype.[[Prototype]] == HTMLElement.prototype
> Opera: Image.prototype === undefined
> I agree, the Safari/IE behaviour makes most sense to me.



Received on Tuesday, 23 August 2011 06:06:20 UTC