Re: [w3c/webcomponents] components v1 native implementation - inner components problem (#615)

Better in customElements.define  add attribute "isContainer".  This component must be connected only after parsing child content. It makes no sense to connect it before the childrens parsed, component anyway will change its content.

Also i have problem with removing children components for my componens like m-form,m-table,m-modaldiv. When i rewrite innerHTML in connectedCallback, for old removed children components anyway invoked connectedCallback. 
I need use function __clear(el){
 while (el.hasChildNodes()) {
  __clear(el.lastChild)
  el.removeChild(el.lastChild);
 }
}

And in connectedCallback must do check firstly:
if(this.parentNode===undefined || this.parentNode==null ) {__clear(this); return;}

It not simple to get rid of removed components. For container component rewriting innerHTML must fully kill existing children components.

For container component before connectedCallback children must be only parsed. After container connectedCallback finished, need connect actual children 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/615#issuecomment-314769196

Received on Wednesday, 12 July 2017 13:30:33 UTC