Re: [w3c/webcomponents] Why do we really need hyphens? (#658)

Couldn't you just use another attribute instead of `is` and not rewrite the entire specification?

```html
<table is="very-generic" also="bar lorem"><table>
```

```javascript
const behaviors = {
  bar: { connectedCallback(elm) { elm.classList.add('bar'); } }
  lorem: { connectedCallback(elm) { elm.classList.add('lorem'); } }
};
const getbehaviors(elm) => elm.getAttribute('also').split(' ').map(name => behaviors[name]);
components.define('very-generic', class {
  connectedCallback() {
    getbehaviors(this).forEach(b => b.connectedCallback(this));
  }
});
```

- or solve it entirely in the JavaScript layer with some kind of mixin (or plugin) strategy? It seems like the high level frameworks could facilitate something like this in a number of ways without requiring a change to the low level spec, which I assume should be either based on classical inheritance with all the imagined problems it can cause *or* mixins with all the actual confusement it can cause; certainly not both?

-- 
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/658#issuecomment-327456237

Received on Wednesday, 6 September 2017 11:35:06 UTC