Re: [w3c/webcomponents] The is="" attribute is confusing? Maybe we should encourage only ES6 class-based extension. (#509)

another idea based on @rniwa ideas with "particle interfaces":
MyFancySelect.js
```js
class MyFancySelect extends customElements.withInterfaces(
  customElements.inputInterface, // input interfaces expose user input via a "value" property (and more props/methods for validation and disabled state) that gets picked by form submission
  customElements.selectInterface // select interface enables native a11y enhancements for selects
) {
}
customElements.define('my-fancy-select', MyFancySelect)
```

index.html
```html
<script async defer src="MyFancySelect.js"></script>
<my-fancy-select fallback="select"><!-- ... --></my-fancy-select>
```

imho, when authoring html, it feels more natural to say: "i want a `my-fancy-select` custom element, but just in case something isnt supported (client fault) or configured wrong (server fault) or failed to download (infrastructure fault), then treat this thing as a normal select.

ofc things like pre and post upgrade selector behavior needs to defined by the spec (does `select` selector matches `<my-fancy-select fallback="select">` pre and/or post upgrade or does it not match at any time?)

how does `class extends HTMLSelectElement` behave? just like you expect it, because `HTMLSelectElement` internally mixes in `inputInterface` and `selectInterface` (and possibly more), but this could be deprecated behavior for BC. if you want a select like thing just mixin the interfaces.

-- 
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/509#issuecomment-301693535

Received on Tuesday, 16 May 2017 07:01:33 UTC