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 22920 - [Custom]: Custom element constructors should have class side inheritance
Summary: [Custom]: Custom element constructors should have class side inheritance
Status: RESOLVED WONTFIX
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14968
  Show dependency treegraph
 
Reported: 2013-08-12 13:55 UTC by Erik Arvidsson
Modified: 2013-08-29 21:47 UTC (History)
2 users (show)

See Also:


Attachments

Description Erik Arvidsson 2013-08-12 13:55:14 UTC
Classes in ES6 have class side inheritance.

DOM in Firefox and WebKit also have class side inheritance.

Custom element constructor does not yet have class side inheritance.

class B extends HTMLElement {}
B = document.register('x-b', B);
assert(B.__proto__ === HTMLElement);

class C extends B {}
C = document.register('x-c', C);
assert(C.__proto__ === B);
Comment 1 Erik Arvidsson 2013-08-26 14:07:30 UTC
Correction to previous post:

s/WebKit/Blink/

old habits die hard
Comment 2 Dominic Cooney 2013-08-27 02:55:13 UTC
FWIW, this is experimentally implemented in Blink.

The way the constructor is discovered is simply dereferencing the 'constructor' property on the provided prototype. Prototype lookup does the rest.

This happens right after the prototype is retrieved from the options object.

The retrieved value isn't scrutinized.

If retrieving the constructor destroys the world, we throw an invalid context exception later (similar to the what happens if retrieving the prototype from the options destroys the world.)

Of course, I'm open to changing any and all of these details. This is just the first cut to get feedback from developers.
Comment 3 Dimitri Glazkov 2013-08-29 21:46:24 UTC
Custom Elements spec just says "Let CONSTRUCTOR be the interface object whose interface prototype object is PROTOTYPE", fully relying on WebIDL properly defining what this means (including class-side inheritance).

From what I could glean, http://dev.w3.org/2006/webapi/WebIDL/#dfn-interface-object does not specify class-side inheritance. Should it?
Comment 4 Dominic Cooney 2013-08-29 21:46:58 UTC
FWIW, the change that implemented constructor-side inheritance experimentally in Blink was rolled out.