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

A couple of use-cases have been named already:

- Hot module replacement
- Designing CustomElements at runtime
- Testing / Automation

So the majority of use-cases seem to be related to authoring and developing CustomElements. Hence, even thought this feature would not benefit users directly, it could remove some frustrations and friction developing with CustomElements. Indirectly that would lead to more developers and makers of (design) tools to adopt them. 

Right now, not being able to redefine CustomElements at runtime is a showstopper for any sort of design tools, REPL or in-browser programming environment.

By principle, JavaScript allows for all sorts of modifications at runtime and we can even re-define a Class:

```js
let MyClass = class {
  constructor() {}
  say() {
    console.log("Hello A")
  }
}

new MyClass().say()
// -> Hello A

MyClass = class {
  constructor() {}
  say() {
    console.log("Hello B")
  }
}

new MyClass().say()
// -> Hello B
```

:)

-- 
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-943187126

Received on Thursday, 14 October 2021 09:37:44 UTC