Re: Custom elements ES6/ES5 syntax compromise, was: document.register and ES6

The polyfill rabbit hole of half-hearted, faux-ES6 polyfilling of
constructor inheritance seems to be far deeper than both conceptually in
code-level affect than our simple examples show. Further, what is so sexy
about forcing the pattern when we can't, hard stop, no-way, polyfill *class
*and *extends*?

In my mind, you gain widespread adoption of this if the legacy case is
super streamlined - if you tell developers:

"Because we forced a constructor pattern, albeit without truly being able
to use class and extends, we hunted and pecked around the DOM and monkey
patched a bunch of things so you can construct one-off, weak sauce variants
of inherited constructors...just to use with this one method...oh, and
don't try to really use ES6 stuff, because we're just faking a small part
of it."

That sounds kinda gross IMO.

Daniel J. Buchner
Product Manager, Developer Ecosystem
Mozilla Corporation


On Thu, Feb 14, 2013 at 2:53 PM, Scott Miles <sjmiles@google.com> wrote:

>
>
>
> On Thu, Feb 14, 2013 at 2:48 PM, Dimitri Glazkov <dglazkov@google.com>wrote:
>
>> On Thu, Feb 14, 2013 at 2:23 PM, Scott Miles <sjmiles@google.com> wrote:
>> > MyButton = document.register(‘x-button’, {
>> >   prototype: MyButton.prototype,
>> >   lifecycle: {
>> >      created: MyButton
>> >   }
>> > });
>> >
>> > What's the benefit of allowing this syntax? I don't immediately see why
>> you
>> > couldn't just do it the other way.
>>
>> Daniel answered the direct question, I think,
>
>
> I must have missed that.
>
>
>> but let me see if I
>> understand the question hiding behind your question :)
>>
>> Why can't we just have one API, since these two are so close already?
>> In other words, can we not just use "constructor" API and return a
>> generated constructor?
>>
>> Do I get a cookie? :)
>>
>> :DG<
>>
>
> Well, yes, here ya go: (o). But I must be missing something. You wouldn't
> propose two APIs if they were equivalent, and I don't see how these are not
> (in any meaningful way).
>

Received on Thursday, 14 February 2013 23:04:57 UTC