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 <dglaz...@google.com>wrote:

>
>
>
> On Wed, Feb 6, 2013 at 9:03 AM, Erik Arvidsson <a...@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<
>
>

Reply via email to