Re: [w3c/webcomponents] Custom Element definition ordering can cause difficult-to-find bugs. (#668)

I'm still battling with this. My current hack is something like this:

```js
connectedCallback() {
 setTimeout(() => {
  this.firstChild instanceof SomeCustomElement // TRUE
 }, 0)
}
```

but

```js
connectedCallback() {
 Promise.resolve().then(() => {
  this.firstChild instanceof SomeCustomElement // FALSE
 })
}
```

. The timing of element upgrades is too tricky to work with (as discussed in #671). I can't reliably detect child element upgrades in a microtask which means I can't reliably do some rendering in the next frame because if I use `setTimeout(..., 0)` this doesn't guarantee logic will fire before the next frame. This results in janky initial rendering.

-- 
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/668#issuecomment-334986178

Received on Sunday, 8 October 2017 06:22:34 UTC