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

Re: ES6 and upgrading custom elements

From: Anne van Kesteren <annevk@annevk.nl>
Date: Tue, 6 Jan 2015 19:59:13 +0100
Message-ID: <CADnb78hf8hcp+G-RhiUi7r55w74q9LW+mrjqXrh=eK_v6sgfXQ@mail.gmail.com>
To: Dimitri Glazkov <dglazkov@google.com>
Cc: WebApps WG <public-webapps@w3.org>
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.

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:43 UTC