Re: [heycam/webidl] Investigate/file bugs on named constructor prototype chain (#276)

`Image.prototype === HTMLImageElement.prototype` is true in WebKit nightly.

Having Image.prototype be Function.prototype would make the story about subclassing Image pretty confused, no?   How would Image determine the prototype of the things it creates?

For what it's worth, Chrome's answer seems to be that Image.prototype is an object with the following properties:

    Object.getPrototypeOf(Image.prototype) === HTMLImageElement.prototype
    Image.prototype.constructor === Image

and `new Image` creates objects whose proto is in fact `Image.prototype`.   So it's not like it's having Function.prototype here either....  What it _is_ having is that objects created via `new Image` have a slightly different proto chain from other images.  I don't see a really good reason for doing that, honestly, and none of the other browsers do.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/276#issuecomment-274529634

Received on Monday, 23 January 2017 16:05:31 UTC