- From: Frank Topel <notifications@github.com>
- Date: Fri, 12 Oct 2018 08:08:26 +0000 (UTC)
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 12 October 2018 08:08:49 UTC
As Firefox seems to have implented a different behaviour (children being available in the `connectedCallback` outright), and as the polyfilled browsers (document-register-element) seem to also grant access to a custom element's children in the `connectedCallback`, would this be the way to implement it cross-browser with minimal performance impact?
```
class myElement extends HTMLElement {
connectedCallback() {
this.init();
}
init() {
if (this.children.length) {
childrenAvailableCallback()
} else {
setTimeout(childrenAvailableCallback.bind(this), 0)
}
}
childrenAvailableCallback() {
/* access to child elements available here */
}
}
```
--
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/551#issuecomment-429242035
Received on Friday, 12 October 2018 08:08:49 UTC