Re: ES6 and upgrading custom elements

On Tue, Jan 6, 2015 at 7:54 PM, Dimitri Glazkov <dglazkov@google.com> wrote:
> Right, that's why to create a valid custom element that subclasses
> HTMLInputElement, you should use type extensions. With type extensions, the
> HTMLInputElement is what's instantiated.

But without using type extensions this will work (provided we sort out
the other bits):

  class X extends HTMLInputElement { ... }
  document.registerElement("x-input", X)
  var xinput = new X

It seems sad to require type extensions (and therefore requiring a
more complicated version of document.registerElement) for translating
this into markup.

Having actual subclassing in JavaScript, but not for elements unless
you use some sort of hack seems sad.


-- 
https://annevankesteren.nl/

Received on Tuesday, 6 January 2015 18:59:40 UTC