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

Re: document.register and ES6

From: Scott Miles <sjmiles@google.com>
Date: Wed, 6 Feb 2013 10:38:05 -0800
Message-ID: <CAHbmOLavJ2MpV1+-fuTh+VeYVy1MLEByDt6rE4SqA9es39c40g@mail.gmail.com>
To: Dimitri Glazkov <dglazkov@google.com>
Cc: Erik Arvidsson <arv@chromium.org>, Daniel Buchner <daniel@mozilla.com>, public-webapps <public-webapps@w3.org>, Boris Zbarsky <bzbarsky@mit.edu>
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() {
>   MyButton.super();
>   // 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);
>
>
> On Wed, Feb 6, 2013 at 10:35 AM, Dimitri Glazkov <dglazkov@google.com>wrote:
>
>>
>>
>>
>> On Wed, Feb 6, 2013 at 9:03 AM, Erik Arvidsson <arv@chromium.org> wrote:
>>
>> Do we need to be able to do "new MyButton" or is
>>
>>> document.createElement/innerHTML/parser sufficient? If we need to be
>>> able to do "new" in the polyfill I think we either need to tweak
>>> document.register or get the developer to cooperate (by writing
>>> different code). At this point I don't see how we can tweak the API
>>> and still fulfill all of the requirements.
>>>
>>
>> Can the "super" call do this work somehow in the polyfill?
>>
>> :DG<
>>
>>
>
>
Received on Wednesday, 6 February 2013 18:38:59 GMT

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