[w3c/webcomponents] [idea] Static observedAttributes property being optional. (#565)

I think it might be nice that if the `observedAttributes` static property is not present on the constructor, then for `attributeChangedCallback` to behave as in v0, where it is called for all attribute changes.

Unless I misread the spec, there is only a [single algorithm](https://w3c.github.io/webcomponents/spec/custom/#element-definition) that uses `observedAttributes` in the spec, and that algorithm doesn't specify what happens when it is undefined, it only specifies what happens when it is "not undefined".

Furthermore, [Section 2.6](https://w3c.github.io/webcomponents/spec/custom/#custom-element-reactions) says

> When any of [a custom element's] attributes are changed, appended, removed, or replaced, [the custom element's] attributeChangedCallback is run.

noting the keyword "any" in that sentence.

Based on the above two facts, then there is nothing that states what the behavior should be if `attributeChangedCallback` is defined while `observedAttributes` is not. In my opinion, it'd be nice for behavior to remain the same, so that migration from v0 to v1 is easy. Plus, it's easy to opt in anyways.

Related (reason why I opened this issue): https://github.com/WebReflection/document-register-element/issues/76

-- 
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/565

Received on Tuesday, 13 September 2016 22:47:41 UTC