[webcomponents] Add authoring guidance for writing custom element constructors (#409)

After #405 lands we should add some examples. Most importantly we should add some authoring requirements for writing constructors, that is, "must"s and "should"s aimed at authors. So far I can think of:

- Authors must include a parameter-less `super()` call as the first statement in their constructor
- Authors must not use `return` override
- Authors should not inspect the DOM or perform any interesting operations (such as fetching a resource) during construction; this should be delayed until attachedCallback [or whatever attachedCallback gets renamed to]. This includes inspecting their own children or attributes (the latter of which can be handled by attributeChangedCallback).
- Authors should use the constructor to set up initial state with default values.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/409

Received on Wednesday, 2 March 2016 19:45:28 UTC