W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2013

Re: document.register and ES6

From: Erik Arvidsson <arv@chromium.org>
Date: Wed, 6 Feb 2013 14:18:40 -0500
Message-ID: <CAJ8+GoiF4QxS-YEVDMhtQJwwqvrji=FUpxt98YfL3irddhhf_A@mail.gmail.com>
To: Scott Miles <sjmiles@google.com>
Cc: Dimitri Glazkov <dglazkov@google.com>, Daniel Buchner <daniel@mozilla.com>, public-webapps <public-webapps@w3.org>, Boris Zbarsky <bzbarsky@mit.edu>
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:57 GMT