Re: [WICG/webcomponents] Updating Element Registration. (#820)

I agree, this would be super useful not only for HMR, but really any authoring tool that wants to build on top of CustomElements. 

I think it’s the nature of JavaScript to be open to modification at runtime. We can already "upgrade" elements once, so why not another time? Why can’t we point the constructor to different classes? 

I think I’ve found a way to create custom elements with the **same name**, but different implementations. It obviously involves some hijacking but it seems to work as far as I can tell. I need to do more tests and see where limitations are. 

Upgrading existing custom elements with a new implementation can be done using standard DOM Node replacements. I will follow-up with some code soon.

Has there been any prior work done in that direction? @pshihn did you follow up on that at all?

-- 
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/820#issuecomment-945714288

Received on Monday, 18 October 2021 12:28:32 UTC