Element Upgrades
Web Components โฉ Custom Elements โฉ
<time-formatted> - example
If browser encounters <custom-element> before customElements.define(), the element is yet unknown, just like any non-standard tag. Undefined elements can be styled with CSS selector:not(:defined)
.
When customElement.define() is called, they are โupgradedโ: a new instance of CustomElement is created for each, and connectedCallback
is called. They become :defined
.
๐ pseudo-class
.whenDefined()
customElements.whenDefined('custom-element').then(() => {
console.log('custom-element defined');
});
Last updated
Was this helpful?