- From: Joseph Orbegoso Pea <notifications@github.com>
- Date: Tue, 28 Jun 2016 01:27:55 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc:
- Message-ID: <w3c/webcomponents/issues/488/228985055@github.com>
This would make it tricky to use `innerHTML` on a random `div` element that hasn't been connected yet, and therefore `querySelector` would not be able to know what tag names are associated with any of the elements. Idea: what if the elements created with `innerHTML` et al are just inert until they exist in a live node tree within the document or within a shadow tree, and are only ever upgraded at that point? So, ```js let div = new HTMLDivElement div.innerHTML = "<my-form></my-form>" // MyForm is not instantiated because we don't know what registry is associated yet. div.querySelector('my-form') // HTMLUnknownElement instance (or similar) someShadowRoot.appendChild(div) div.querySelector('my-form') // MyForm instance, has been upgraded based on root's registry. someShadowRoot.removeChild(div) div.querySelector('my-form') // HTMLUnknownElement, and MyForm instance was GCed? ``` Downside would be a loss of the MyForm instance in that example. Maybe there's other ways to make it happen? I can think of some nice ways, but they break backwards compatibility. For example, perhaps `querySelector` only works on "live" nodes that are in document or shadow tree, but then that means `querySelector` would not work on trees that haven't been attached yet. --- 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/488#issuecomment-228985055
Received on Tuesday, 28 June 2016 08:28:31 UTC