- From: Dimitri Glazkov <dglazkov@google.com>
- Date: Tue, 6 Jan 2015 11:09:38 -0800
- To: Anne van Kesteren <annevk@annevk.nl>
- Cc: WebApps WG <public-webapps@w3.org>
Received on Tuesday, 6 January 2015 19:10:05 UTC
On Tue, Jan 6, 2015 at 10:59 AM, Anne van Kesteren <annevk@annevk.nl> wrote: > 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. > You shouldn't need anything more complicated: class X extends HTMLInputElements { .. } X.extends = "input" // additional line. document.register("x-input", X) var xinput = new X > > Having actual subclassing in JavaScript, but not for elements unless > you use some sort of hack seems sad. > The type extensions is a hack, I agree :( :DG<
Received on Tuesday, 6 January 2015 19:10:05 UTC