> > ```js > class Derived extends Base { > constructor(...args) { > super(a, b, c); > doInitCode(this, ...args); > } > } > ``` > > via a function > > ```js > function makeDerived(...args) { > const o = Reflect.construct(Base, [a, b, c], Derived); > doInitCode(o, ...args); > return o; > } > ``` >
That's still theoretically possible, because new.target (Derived in this case) carries with in the list of slots that must be allocated. Once we "super up" to the root constructor, the allocator gets that list from new.target. But as I understand it, the difficulty for HTML element subsclassing is that you don't event know what "Derived" might be until sometime later.
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss