[Bug 17146] [Custom]: Constructor generation algorithm doesn’t create the right prototype chain

https://www.w3.org/Bugs/Public/show_bug.cgi?id=17146

--- Comment #2 from Dominic Cooney <dominicc@chromium.org> 2012-05-29 01:31:25 UTC ---
(In reply to comment #1)
> This is tricky. We're trying to dance around the notion of DOM element
> prototypes without naming them directly. I feel like the
> BASEINTERFACE.prototype is a cop-out.

I think you need to embrace the fact that this interacts with JavaScript. The
BASEINTERFACE.prototype is clumsy because it is pseudo-JavaScript syntax. Why
not adopt language from the Web IDL spec for referring to the prototype?

> Could you not take var div = document.createElement('div') and treat it as a
> prototype for a custom DOM element. Why not?

You could, but it would be bad for these reasons:

- document.createElement could have been replaced by script, so you would need
all this torturous language to refer to the real createElement that would be
worse than just referring to the prototype that you mean.

- it ends up creating a superfluous div *instance* to sit on the prototype
chain. Do you want to require implementations make the following madness work?

var c = /* create custom element */;
document.body.appendChild(c);
document.body.appendChild(Object.getPrototypeOf(c));
// look upon my document oh ye mighty and despair

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Tuesday, 29 May 2012 01:31:28 UTC