Re: [w3c/webcomponents] connectedCallback timing when the document parser creates custom elements (#551)

First off, it's literally impossible to have children or attributes before an element is constructed because we can't add children to an element yet to exist. Just think about the way a JS code would construct an element:
```js
const someElement = document.createElement('some-element');
someElement.setAttribute('title', 'This is some element!');
someElement.appendChild(document.createElement('other-element'));
```

In the case of upgrading, however, the element already exists in the tree, and we're iterating over them to instantiate. In particular, if a custom element definition comes in a deferred script or an async script, then the custom elements that already exist in the document needs to be upgraded.

We could have gone our way to delete attributes & detach from children, but that would have caused serious performance issues in addition to flush of content.

-- 
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-429393212

Received on Friday, 12 October 2018 17:02:04 UTC