Re: [WICG/webcomponents] Provide a mechanism to prevent or coalesce upgrades when defining new custom elements (#922)

Maybe it would make sense to extend existing `define` method with an additional field in `options` param?

As an user we would provide a hint to the browser that we would like to `upgrade` a batch of custom elements manually later by passing `upgrade: false` to `define` method:

```JS
customElements.define('my-element-1', MyElement1, { upgrade: false });
...
customElements.define('my-element-2', MyElement2, { upgrade: false });
```

After that when the custom elements module(s) are imported, parsed and executed, we would call upgrade on elements that we need:

```JS

import './my-element-1.js';
import './my-element-2.js';
customElements.upgradeMultiple(['my-element-1', 'my-element-2']);
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/922#issuecomment-821972963

Received on Sunday, 18 April 2021 10:58:54 UTC