Re: [WICG/webcomponents] Cleaning up (undefining) custom elements? (#754)

Thanks for clarifying terminology and explaining what that code example actually does. I like it. **Pointing** a CustomElement to another class would be great!

From following the discussion and reason for closing I just got the impression that we’re lacking examples to justify the effort of implementing this feature.

Let’s imagine that we would have 3 different `video-player` CustomElements (Vendor A, Vendor B, Vendor C) that we offer users to choose from. We can imagine to implement videos on our website like that:

```html
<video-player src="video.mp4"></video-player>
```

A user could then choose between the desired `video-player` from 3 options:

```html
<input type="radio" value="a" />
<input type="radio" value="b" />
<input type="radio" value="c" />
```

When a user makes a choice, we could simply point the `video-player` to the chosen implementation (“hey, here’s a new constructor for the already defined CustomElement) without making changes to the DOM. I guess that’s what Hot Module Replacement is about, but I tried to make up a case in user land. 

I think there are far more useful things when it comes to tooling and I think that implementing this missing feature would unlock a lot of wonderful things that would make using CustomElements feel more natural and at home within the programming environment of a browser. 

-- 
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/754#issuecomment-943526194

Received on Thursday, 14 October 2021 16:35:55 UTC