Re: [w3c/webcomponents] Some sort of guarantee on custom element lifecycle order of events (#737)

> This is by design. So you design robust components that can be created imperatively.

This is mostly a problem when creating them declaratively: they start in HTML, then parsed, and depending on various factors, children (of an element with child-observing logic) may or may not be upgraded inside of (for example) the observing-element's `connectedCallback` invocation.

When I create elements imperatively, this problem doesn't exist in my cases.

> .whenRegistered(CustomElementConstructor)

That would be helpful, then we don't need to care what the elements are named! Something like `.get(Constructor)` could help too (returns string or undefined) to avoid async when possible:

```js
if (!customElements.get(SomeElementConstructor)) await customElements.whenDefined(SomeElementConstructor)
```



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/737#issuecomment-367570206

Received on Thursday, 22 February 2018 05:17:18 UTC