- From: /#!/JoePea <trusktr@gmail.com>
- Date: Wed, 13 Apr 2016 11:12:11 -0700
- To: public-webapps@w3.org
I personally don't like this limitation. I think Custom Elements would be better if we could create elements that have <any> <name> <that> <we> <want>, with the possible exception that we can't override the native elements. Based on my previous email about registering elements on shadow roots, I think being able to choose any name would make things just cleaner: ```js // --------------- SomeElement.js import MyElement from './MyElement' export default class SomeElement extends HTMLElement { constructor() { this.root = this.createShadowRoot() this.root.registerElement('MyElement', MyElement) // <myelement> or <MyElement> const frag = document.createDocumentFragment() frag.innerHTML = ` <div> <MyElement> ... </MyElement> </div> ` this.root.appendChild(frag) } static get observedAttributes() { return [ ... ] } connectedCallback() { ... } disconnectedCallback() { ... } attributeChangedCallback() { ... } } // --------------- app.js import SomeElement from './SomeElement' // elements registered on the document won't cross into shadow roots document.registerElement('SomeElement', SomeElement) document.body.appendChild(document.createElement('someelement')) ``` /#!/JoePea
Received on Wednesday, 13 April 2016 18:13:18 UTC