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

So connectedCallback is called with 0 children in the case of upgrades, but if I am to do:

```js
var myEl = document.createElement('my-element');
myEl.appendChild(document.createElement('span'));

var frag = document.createDocumentFragment();
frag.appendChild(myEl);

document.body.appendChild(frag);
```

Then "my-element"'s connectedCallback is called when the fragment is inserted into the body and it will have 1 children in this case. 

So a custom element with expectations on children will need to:

1. Check if has children in connectedCallback, do stuff
2. Set up a mutation observer and do stuff when nodes are added (which will happen in the case of upgrades).

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

Received on Tuesday, 23 August 2016 16:47:05 UTC