Comment by wildpeaks
1 day ago
My only issue with Web Components is that, by design, they need to be registered with a globally unique tagname and can't be unregistered.
It's a reasonable compromise given the original purpose of custom elements, but in practice it ends up more maintainable to be inspired by its structures without using real custom elements despite I was initially excited that jsdom supports custom elements nowadays.
Scoped custom element registries should help with this letting you register to a shadow root instead of globally. [1] Unfortunately Firefox hasn't come to the party yet. [2]
[1]: https://developer.mozilla.org/en-US/docs/Web/API/Web_compone...
[2]: https://bugzilla.mozilla.org/show_bug.cgi?id=1874414
Why is the uniqueness constraint of tag names a problem?
The scoped custom element registries proposal covers some of the use cases where global elements are problematic https://github.com/WICG/webcomponents/blob/gh-pages/proposal...