-
Notifications
You must be signed in to change notification settings - Fork 391
Closed
Labels
Description
Following from #425.
The :defined pseudo allows basic styling before an element becomes defined, such as reserving space for the element. However, that isn't always sufficient, and it feels like an extensible web violation to be able to react to upgrades via CSS but not via script.
A property that resolves once an element is defined is a more extensible system. Could/should this be a static property on the class? (edit: lol no)
I don't want my element to be defined ahead of elements it uses in its shadow
Promise.all(
[
'x-foo',
'x-bar',
'x-whatever'
].map(tagName => document.whenDefined(tagName))
).then(() => {
document.defineElement('my-element', MyElement);
});I don't want to show an article until all custom elements have defined
fetch(articleURL).then(r => r.text()).then(text => {
articleContainer.innerHTML = text;
return Promise.all(
[...articleContainer.querySelectorAll(':not(:defined)')]
.map(el => document.whenDefined(el.tagName))
);
}).then(showArticle);Reactions are currently unavailable