Re: [w3c/webcomponents] Scoped Custom Element Registries (#716)

@jarrodek 

<details>>summary>off topic:</summary>

> build process of each application this would inevitably lead to name collision and component registration errors 

For that problem, what I do is my libraries export only classes, then I let the consumer run

```js
import {TheClass} from ''the-library"
customElement.define('any-name-the-user-wants', TheClass)

// alternative API provided by my lib:
TheClass.define('any-name') // defined <any-name> elements.
```

This way the end user has control on the application side instead of the library dictating the name. 

Lastly, all of my classes come with default names, that the user can opt into:

```js
import {TheClass} from ''the-library"
TheClass.define() // this registers the element with a default name, f.e. <the-class>

// alternatively register all classes in the whole lib with their default names:
import {useDefaultNames} from ''the-library"
useDefaultNames()
```

This leaves applications with control. If they have a collision, the specific application can be modified to specify a different name.

> Some of them may operate on private data (either user or customers data). This leads to the decision made by our security team to disable global registry and custom elements altogether (we use proxy object on window).

As @frank-dspeed said, and as your security team should be saying, you should run entirely separate apps inside iframes. That's how you get security. Plus, an added benefit of this is that it would reduce custom element naming collisions because each iframe has its own registry.

</details>

But please, lets not create off-topic conversations, because it make it more difficult and tedious for the spec authors to collaborate on the issue. Your issues are related, but not directly on topic.

Moderators, if you can please mark this (and a couple previous replies) as off-topic, it'll prevent them from showing up in Google search results.

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

Received on Sunday, 10 May 2020 18:26:26 UTC