- From: Nick Dugger <nick.dugger1@gmail.com>
- Date: Wed, 13 Apr 2016 13:53:59 -0500
- To: "/#!/JoePea" <trusktr@gmail.com>
- Cc: public-webapps WG <public-webapps@w3.org>
- Message-ID: <CACrTssbdiBDNeysAC-sXduxO_ZK+6QPRvJOwz45Q++KCXqf8dA@mail.gmail.com>
I personal don't mind the hyphenation requirement for custom elements. Tab Atkins brings up a great point about ensuring that new elements will be able to be added to spec without worry of name conflicts with existing custom elements on the page. It's much more future proof, in my opinion. On Wed, Apr 13, 2016 at 1:12 PM, /#!/JoePea <trusktr@gmail.com> wrote: > 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:54:28 UTC