Re: [Custom Elements] Not requiring hyphens in names.

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