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

True, having an actual implementation definitely would help. This is a good place to determine what the features will be for that trial implementation.

I still this that 

```js
  constructedCallback(elm) {
    if(elm.hasAttribute('has')) {
      CustomBehaviors.init(elm); // puts 5 new CustomBehavior() in WeakMap
    }
  }
```

is too much work for authors writing custom elements. They shouldn't have to wire up this functionality. It should be baked in.

Literally, to make things easy, all they should need to do is

```js
elementBehaviors.define('foo', Foo)
```

then the rest is automatic. If an element has the `has=""` attribute or whatever it would be called, then the instances will be automatically created without any further code needed at all:

```html
<div has="foo"></div>
```

And that's all. Nothing else should be required.

-- 
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-328221913

Received on Friday, 8 September 2017 21:49:12 UTC