Re: Custom element design with ES6 classes and Element constructors

On Mon, Jan 12, 2015 at 9:11 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> On 1/12/15 12:20 PM, Tab Atkins Jr. wrote:
>
>> Proto munging isn't even that big of a deal.
>>
>
> That really depends.
>
> For example, dynamically changing __proto__ on something somewhat
> permanently deoptimizes that object in at least some JS engines. Whether
> that's a big deal depends on what you do with your objects.


This is true.

Would like to point out that we're not talking about a general case here.
The actual proto munging in custom elements spec is minimized to a pretty
small set.

Given that most engines use lazily created wrappers, the actual setting of
the prototype won't even need to happen unless the developer first accessed
the element, thus creating a wrapper.

Also, the current design doesn't change the prototype chain arbitrarily:
the effect is limited to inserting a sub-chain into the existing chain.
IOW:  A-E + B-C-D-E  --> A-B-C-D-E. Thus, the base type is always the same.

:DG<

Received on Wednesday, 14 January 2015 16:53:29 UTC