I'm currently testing the performance of Custom Elements, so I stumpled upon the need to unregister a previously registered element. I couldn't find anything about that.
I think that could probably be needed, but before I have not researched this problem in more detail I'll not do any assumptions.
I know I could do it with refreshing the page, but that's not the point here.
What I've done so far to register an element the native, spec-like way:
document.registerElement('my-element', {
prototype: Object.create(HTMLElement.prototype)
});
Custom elements cannot be self-closing because HTML only allows a few elements to be self-closing. Always write a closing tag ( <app-drawer></app-drawer> ).
Custom Elements allow web developers to define new types of HTML elements. The spec is one of several new API primitives landing under the Web Components umbrella, but it's quite possibly the most important. Web Components don't exist without the features unlocked by custom elements: Define new HTML/DOM elements.
Autonomous custom elements are new HTML tags, defined entirely by the author. They have none of the semantics of existing HTML elements, so all behaviors need to be defined by the author. Customized built-ins extend existing HTML elements with custom functionality. They inherit semantics from the elements they extend.
The CustomElementRegistry interface provides methods for registering custom elements and querying registered elements. To get an instance of it, use the window. customElements property.
There is one or two discussions on google groups about unregistering elements but as far as I know no solution so far. https://groups.google.com/forum/#!topic/polymer-dev/31W69ZE1Wng
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With