webcomponents.org icon indicating copy to clipboard operation
webcomponents.org copied to clipboard

how to unregister a custom element

Open mohamedafzal03 opened this issue 3 years ago • 1 comments

Origin page HI to register a custom element, window.customElements.define('my-custom-element', MyCustomElement); I want to unregister a custom element , is there any possibilities? like(window.customElements.undefine('my-custom-element') will be helpful if u guys share your insights.

mohamedafzal03 avatar Jan 22 '21 11:01 mohamedafzal03

this is not possible at the moment. maybe this would help in the future: https://github.com/webcomponents/polyfills/tree/master/packages/scoped-custom-element-registry

If you'd like to replace a registered component, you could register a proxy wich then later could replace the implementation.

jogibear9988 avatar Dec 29 '21 09:12 jogibear9988

This is a spec question. It's currently impossible to unregister an element (and there are questions about what that would mean). You can see the spec issue here: https://github.com/WICG/webcomponents/issues/754

justinfagnani avatar Sep 14 '22 15:09 justinfagnani