Re: document.register and ES6

On Fri, Feb 8, 2013 at 12:18 PM, Scott Miles <> wrote:
> 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?

1. Because an element with tagName === 'my-button' will not be an
HTMLButtonElement instance.
2. Because ES5 cannot set @@create so you need to create a new
function that wraps the original.

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

1 can be implemented using 3.

> 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?

I think you are misunderstanding some things. There is no need to wait
for ES6 class syntax. ES6 class syntax is just syntactic sugar over
ES5 + __proto__. ES6 has formalized the semantics for "new Expr" to
use two phases. This cannot be done in useland code but we can achieve
the same using ES5 spec internals by mutating [[Construct]] (instead
of @@create in ES6).

A lot of these later discussions have been driven by a desire to be
able to shim this. If we didn't need to shim this we would not need to
have two different functions for one entity.


Received on Friday, 8 February 2013 17:35:20 UTC