Re: [w3c/webcomponents] [feature request] change when upgrade/connected happens during parsing, so that it is the first event in the following microtask (#787)

I'm not sure what you mean by mutation observer doesn't get called for the initial children. It definitely gets called at least once in the following code as I tested in Safari 12.0.2 and Chrome 71.0.3578.98. It logs "child changed!" once then "child changed!" one second later as more child is inserted:
```
<!DOCTYPE html>
<html>
<body>
<pre id="log"></pre>
<script>

customElements.define('test-parent', class extends HTMLElement {
    constructor()
    {
        super();
        this._observer = new MutationObserver(() => this.childChangedCallback());
        this._observer.observe(this, {childList: true});
    }

    childChangedCallback()
    {
        log.textContent += 'child changed!\n';
    }
});

setTimeout(() => {
    document.querySelector('test-parent').appendChild(document.createElement('div'));
}, 1000);

</script>
<test-parent><div></div><div></div></test-parent>
</body>
</html>
```

-- 
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/787#issuecomment-458456606

Received on Tuesday, 29 January 2019 08:50:04 UTC