最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Unregister custom element - Stack Overflow

programmeradmin1浏览0评论

Is it possible to unregister a custom element that has been created by createCustomElement?

We use Web Components to wrap out vertical features, all 'parts' of the feature are downloaded before the Web Component is added to the DOM.

What we would really like is to pletely destroy the ponent when the feature is no longer active but there it looks like there is no API available.

Has anyone had any luck with this?

Is it possible to unregister a custom element that has been created by createCustomElement?

We use Web Components to wrap out vertical features, all 'parts' of the feature are downloaded before the Web Component is added to the DOM.

What we would really like is to pletely destroy the ponent when the feature is no longer active but there it looks like there is no API available.

Has anyone had any luck with this?

Share Improve this question asked Dec 13, 2018 at 8:03 SteoatesSteoates 3,1685 gold badges28 silver badges43 bronze badges 2
  • I only know of one way, but it is rather destructive.Reload the browser page! :) – Intervalia Commented Dec 13, 2018 at 16:26
  • here is one relevant issue still unresolved in 2022 github./WICG/webponents/issues/754 – calmar Commented Feb 10, 2022 at 18:00
Add a ment  | 

1 Answer 1

Reset to default 10

At the Angular level, there doesn't seem to be any "destroy" or "remove" function alongside createCustomElement in @angular/elements.

At the DOM level, looking at the CustomElementRegistry interface, the interface provided by customElements, there is no "undefine" or similar to acpany define. (This may be part of why Angular doesn't have a "destroy" or "remove"...)

So I'd say: No, you can't remove it.

发布评论

评论列表(0)

  1. 暂无评论