- From: Joseph Orbegoso Pea <notifications@github.com>
- Date: Tue, 28 Jun 2016 02:17:31 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc:
- Message-ID: <w3c/webcomponents/issues/488/228996224@github.com>
Just some more brain-storming, but not necessarily a solution: Maybe a registry can be an instantiable? ```js let myRegistry = new ElementRegistry myRegistry.define('my-form', MyForm) let shadowRoot = someEl.createShadowRoot(myRegistry) let frag = document.createDocumentFragment(myRegistry) let form = frag.createElement('my-form') shadowRoot.appendChild(form) frag.appendChild(new MyForm) // works based on supplied registry let div = frag.createElement('div') div.innerHTML = '<my-form></my-form>' // uses myRegistry to find class div.querySelector('my-form') ``` In the case that`div` is removed and attached to a new tree, then perhaps lookup is reversed: a name is looked up by class. If the new node tree where `div` is connected to has a name associated with `MyForm`, then maybe that element in `div`'s tree takes that new name? If the name isn't registered, then it takes the name `<unknown-element>` and has a property `class` to reference the class. ... Or, what if registries are used to specify context? ```js div.querySelector('my-form', myRegistry) // find nodes that are instance of whatever is mapped in the registry. someElement.innerHTML('<my-form></my-form>', myRegistry) ``` Any other ideas on how to possibly scope elements? Until this is possible, I can't foresee stopping to use JS libraries to achieve this (for example using scoped variables in React). --- 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-228996224
Received on Tuesday, 28 June 2016 09:18:10 UTC