Re: [w3c/webcomponents] A new attribute similar to is="", but would allow multiple behaviors to be attached to a given element. (#662)

@prushforth Thanks for the reply! I think you misunderstood what I proposed.

> you are promoting what appears to me to be more complicated solutions (multiple inheritance / mixins). 

On the contrary, the idea in this issue does not require inheritance at all; and they are not mixins.

In the example, from above:

```js
class Baz {
  // ...
}

shadowRoot.elementBehaviors.define('baz', Baz)
```

the `Baz` class _does not inherit_ from anything, therefore it also _doesn't have multiple inheritance_.

The `is=""` attribute, in contrast, requires inheritance, and is more complex and limited.

The examples in this issue are not mixins; they are multiple classes who standalone instances can operate on the same object (a DOM element). As with any sort of code reading or setting properties on the same object, there's room for collision, but that doesn't make them mixins.

Multiple jQuery plugins, for example, can operate on the same Element, but they aren't mixins.

Nothing's perfect, however the idea in this issue is more powerful than the current `is=""` attribute, and simpler.

-- 
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/662#issuecomment-331595592

Received on Saturday, 23 September 2017 01:11:44 UTC