- From: Justin Fagnani <notifications@github.com>
- Date: Fri, 23 Feb 2018 09:59:06 -0800
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/webcomponents/issues/716/368088899@github.com>
@caridy I don't think this proposal is at different of a level than the current CustomElementRegistry, and I don't think it would be only for tools. In fact a major reason for proposing this is to get closer to the scoping and workflow that pure-JS component solution enjoy. Consider the following React-ish example: ```js import {ChildComponent} from './child-component.js'; export class ParentComponent extends Component { render() { return <ChildComponent>Hello</ChildComponent>; } } ``` This has no problem with several components being named ChildComponent, supports renaming, and multiple versions in the same program. I think we can get very close to this with custom elements (this example using LitElement for conciseness, it just creates a shadow root automatically): ```js import {ChildElement} from './child-element.js'; import {registry} from './registry.js'; registry.define('child-element', ChildElement); export class ParentElement extends LitElement { render() { return html`<child-element>Hello</child-element>; } } ``` This has no problem with several components being named child-element, supports renaming, and multiple versions in the same program, with only a slightly addition in LoC for making sure the element is registered. I see this as very hand-writable. -- 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/716#issuecomment-368088899
Received on Friday, 23 February 2018 17:59:34 UTC