Re: Custom Elements: Upgrade et al

From: Anne van Kesteren <annevk@annevk.nl>

> No, I'm saying there would be another primitive operation, similar to the extended structured cloning proposed elsewhere, to accomplish cloning without side effects.

You are referring to https://github.com/dslomov-chromium/ecmascript-structured-clone ? That invokes the constructors. (It uses the imprecise ES5-era "let output be a new Array..." language, but if upgraded to ES6 that becomes "let output be Construct(%Array%, 0)", and similar.)

There's really no way to get objects of the right class without either:

1. Invoking the constructor; or
2. Proto-swizzling an object that was allocated without using the constructor.

2 is broken in many ways if we allow user-defined constructors. (This is is why the "Dmitry proposal" specifically disallows user-defined constructors, in favor of inheriting the HTMLElement constructor.)

So is your proposal 1 or 2?

Received on Thursday, 7 May 2015 17:23:41 UTC