Re: [w3c/webcomponents] Custom Element - untrackable upgrade (#671)

> CE base-classes/frameworks could implement a getter that returns the properties that it generates accessors for

I don't think I like the idea of another `observedAttributes` like static accessor, specially because we're mostly talking about prototype accessors and inheritance done right with accessors is not as trivial as it looks like.

I've rarely seen components following this pattern for attributes:
```js
class B extends A {
  static get observedAttributes() {
    // Set used to enable overwrites
    return new Set(super.observedAttributes.concat(['b', 'c']));
  }
}
```

I strongly doubt accessors will be handled as such:
```js
class B extends A {
  static get observedAccessors() {
    const p = super.prototype;
    const accessors = function (k) { return !('value' in Object.getOwnProperty(this, k)); };
    return new Set(Reflect.ownKeys(p).filter(accessors, p)
        .concat(Reflect.ownKeys(this.prototype).filter(accessors, this)));
  }
}
```

which is more convoluted than `.whenDefined` ... yet I have the feeling this Custom Elements part will never be too welcomed; it feels like CE are just second-class citizens on the DOM.



-- 
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/671#issuecomment-333594550

Received on Monday, 2 October 2017 16:52:48 UTC