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

Re: document.register and ES6

From: Scott Miles <sjmiles@google.com>
Date: Fri, 8 Feb 2013 09:18:13 -0800
Message-ID: <CAHbmOLZaUNKGioijHVX2YwcuxZ+QfX_fAg_hdjzqwHK5ZCY_AA@mail.gmail.com>
To: Erik Arvidsson <arv@chromium.org>
Cc: public-webapps <public-webapps@w3.org>, daniel <daniel@mozilla.com>, Boris Zbarsky <bzbarsky@mit.edu>, Dimitri Glazkov <dglazkov@google.com>
Sorry, I'm not quite following.

1. We cannot really extends anything else but
HTMLElement/HTMLUnknownElement.
2. We cannot return the correct function object from document.register.

I don't see why these are true?

(Btw note that my 'solution 3' removes the 'return a function from
register' and instead puts that into the intermediate function.)

Also, you and Dimtiri keep talking about polyfills, but I'm talking about
the *spec* first.

Are you saying that the spec for document.register will simply require ES6
and everything else we be some kind of hack? I guess I thought the idea was
to spec document.register such that it could be implemented by browser
vendors *before* class-syntax or JS inheritance for DOM was available. Am I
misunderstanding?


On Fri, Feb 8, 2013 at 9:11 AM, Erik Arvidsson <arv@chromium.org> wrote:

> On Fri, Feb 8, 2013 at 11:54 AM, Scott Miles <sjmiles@google.com> wrote:
> > The idea is supposed to be that 1 and 3 are only stopgaps until we get
> 'what
> > we want'. In the future when you can derive a DOM element directly, both
> > bits of extra code can fall away. Was that clear? Does it change
> anything in
> > your mind?
> >
> > If we go with 2, I believe it means nobody will ever use a custom element
> > without having to load a helper library first to make the nasty syntax go
> > away, which seems less than ideal. I donno, I'm not 100% either way.
>
> 1 and 3 have nasty syntax too so until you can depend on ES6 you
> probably want to use a helper function no matter what.
>
> var MyElement = defineClass(HTMLElement, {
>   constructor: function() {},
>   method: function() {},
>   get prop() {},
>   set prop(v) {}
> });
> MyElement = document.register('my-element', {
>   class: MyElement
> });
>
> I believe a polyfill would most likely actually just be a shim (in the
> terms we have started to use) because:
>
> 1. We cannot really extends anything else but
> HTMLElement/HTMLUnknownElement.
> 2. We cannot return the correct function object from document.register.
> 3. We cannot setup the [[Prototype]] in IE.
> 4. The fixup is async at best
>
> and since it just a shim you might as just impose extra restrictions
> on the usage. These extra restrictions could be to use helper
> functions.
>
> --
> erik
>
Received on Friday, 8 February 2013 17:18:41 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:57 GMT