Re: Custom element design with ES6 classes and Element constructors

On Thursday, January 15, 2015, Domenic Denicola <d@domenic.me> wrote:

> Just to clarify, this argument for symbols is not dependent on modules.
> Restated, the comparison is between:
>
> ```js
> class MyButton extends HTMLElement {
>   createdCallback() {}
> }
> ```
>
> vs.
>
> ```js
> class MyButton extends HTMLElement {
>   [Element.create]() {}
> }
> ```


This doesn't save you anything, classes can have statics and the statics
inherit, so the .create will cause issues with name conflicts anyway.

We should probably introduce a new namespace if we want to do this.


>
> > We're already doing some crude namespacing with *Callback. I'd expect
> that as soon as the first iteration of Custom Elements is out, people will
> copy the *Callback style in user code.
>
> This is a powerful point that I definitely agree with. I would not be
> terribly surprised to find some library on the web already that asks you to
> create custom elements but encourages you supply a few more
> library-specific hooks with -Callback suffixes.
>
>

Received on Wednesday, 28 January 2015 04:56:30 UTC