This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25813 - [Custom]: Throw Exception when EXTENDS and PROTOTYPE have a mismatch
Summary: [Custom]: Throw Exception when EXTENDS and PROTOTYPE have a mismatch
Status: RESOLVED WONTFIX
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14968
  Show dependency treegraph
 
Reported: 2014-05-19 19:46 UTC by Daniel Freedman
Modified: 2015-01-05 11:36 UTC (History)
4 users (show)

See Also:


Attachments

Description Daniel Freedman 2014-05-19 19:46:57 UTC
Given the current spec language, it is possible to construct an element that claims to extend from something like HTMLButtonElement, but does not have one in the prototype.

Example:

document.registerElement('not-input', {
  extends: 'input',
  prototype: HTMLElement.prototype
});

Elements like this will be a footgun, as they will appear to be regular type extension elements, but will be missing expected API and IDL properties (in UAs that implement IDL in prototype).

I think the spec should say that UAs should throw at the registration of such a frankenstien's monster of an element and spare developers and users from having to double check prototypes of type extensions.
Comment 1 Dominic Cooney 2014-05-19 23:24:02 UTC
I don't think we should make this change. I don't think there is anything new in this bug report that wasn't already considered.

IIRC we ended up with the lassez-faire model we have today because it is simpler,  more flexible, it reflects what you can do today with __proto__ twiddling, it doesn't afford the UA any real protection or benefits because you can always reset the prototype later anyway, and it might have valid (though marginal) uses.

From the implementation's point of view this is not a huge deal, we would just need to scrabble over the prototype more.