Re: [w3c/webcomponents] Undocumented behaviour with regards to attributeChangedCallback and DOM access (#767)

Perhaps I should rephrase. Essentially what I'm asking is if the following statements are correct:

The spec explicitly does not allow manipulating childNodes in the `constructor`. For example, if you use `this.appendChild()` in the constructor of a Custom Element, the browser will throw some form of error.

However, the spec allows manipulating the childNodes of an element in the `attributeChangedCallback`, _even when the children from the main document have not been attached yet_.

If a Custom Element adds children during one of these lifecycle callbacks, any children from the main document are appended _after_ the children inserted by the Custom Element.

In other words, the following example is valid according to the spec and behaves as expected: https://codepen.io/ruphin/pen/PyJXOe?editors=1000

-- 
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/767#issuecomment-429683528

Received on Monday, 15 October 2018 01:41:34 UTC