Re: document.register and ES6

On Wed, Feb 6, 2013 at 1:38 PM, Scott Miles <sjmiles@google.com> wrote:
> Sorry, replace MyButton.super() with MyButton.super.call(this);
>
>
> On Wed, Feb 6, 2013 at 10:37 AM, Scott Miles <sjmiles@google.com> wrote:
>>
>> So, neglecting issues around the syntax of document.register and the
>> privatization of callbacks, is it fair to say the following is the intended
>> future:
>>
>> class MyButton extends HTMLButtonElement {
>>   constructor() {
>>     super();
>>     // make root, etc.
>>   }
>> }
>> document.register('x-button', MyButton);
>>
>> If so then can we do this in the present:
>>
>> MyButtonImpl = function() {

What do you mean here?

>>   MyButton.super();

Did you get that backwards? I don't see how MyButtonImpl can be
derived from MyButton.

>>   // make root, etc.
>> };
>> MyButtonImpl.prototype = Object.create(HTMLButtonElement, { ... });
>>
>> // the ‘real’ constructor comes from document.register
>> // register injects ‘super’ into MyButton
>> MyButton = document.register(‘x-button’, MyButtonImpl);

What is the relationship between MyButton and MyButtonImpl?

If MyButton.__proto__ === MyButtonImpl and
MyButton.prototype.__proto__ === MyButtonImpl.prototype then this
might work (but this cannot be polyfilled either).

--
erik

Received on Wednesday, 6 February 2013 19:19:28 UTC