Re: alternate view on constructors for custom elements

2015-07-17 Thread Ryosuke Niwa
> On Jul 17, 2015, at 1:14 PM, Travis Leithead > wrote: > > From: Domenic Denicola [mailto:d...@domenic.me] > >>> window.XFoo = document.registerElement(‘x-foo’, XFooStartup); >> >> Why is XFoo different from XFooStartup? If I define a method in XFooStartup, >> does it exist in XFoo? > > T

RE: alternate view on constructors for custom elements

2015-07-17 Thread Domenic Denicola
From: Travis Leithead [mailto:travis.leith...@microsoft.com] > if super() is absolutely required for a constructor in a class > that extends something, is there a requirement about when in the > constructor method it be invoked? Must it always be the first call? Can it be > later on, say at the en

RE: alternate view on constructors for custom elements

2015-07-17 Thread Travis Leithead
From: Domenic Denicola [mailto:d...@domenic.me] > >From: Travis Leithead [mailto:travis.leith...@microsoft.com] > >> Something magical happens here. The use of super() is supposed to call the >> constructor of the HTMLElement class—but that’s not a normal JS class. It >> doesn’t have a defined

Re: alternate view on constructors for custom elements

2015-07-17 Thread Boris Zbarsky
On 7/17/15 2:03 PM, Travis Leithead wrote: Something magical happens here. The use of super() is supposed to call the constructor of the HTMLElement class—but that’s not a normal JS class. It doesn’t have a defined constructor() method Sure, but neither does Array. What super() actually does i

RE: alternate view on constructors for custom elements

2015-07-17 Thread Domenic Denicola
From: Travis Leithead [mailto:travis.leith...@microsoft.com] > Something magical happens here. The use of super() is supposed to call the > constructor of the HTMLElement class—but that’s not a normal JS class. It > doesn’t have a defined constructor() method [yet?]. Yep. We'd need to define o

alternate view on constructors for custom elements

2015-07-17 Thread Travis Leithead
OK, after reading Dominic's proposal [1], I'm a little confused. I thought that I understood how constructors should work, but there's some magic going on that I can't follow... I'm sure you folks can help. ``` class CustomElement extends HTMLElement { constructor() { super(); } } S