Netflix / x-element

A dead simple starting point for custom elements.
Apache License 2.0
28 stars 12 forks source link

Improve initialization #18

Closed theengineear closed 5 years ago

theengineear commented 5 years ago

@klebba , here are some fairly minimal updates spurring from some recent deep-dives into the custom element spec and some conversations we've had. I'll comment on the code to make things as clear as possible. I opened up issues and tagged them in the commits.

theengineear commented 5 years ago

@klebba , I ended up removing the hasConnected getter after all. We have almost no non-static functions and I feel like I would have wanted to change the name to initialized, which I don't want to conflict with properties declared on the element.

theengineear commented 5 years ago

Ready for a final review, tests are all passing for me. I haven't checked this change set on elements outside this repo though. I'll take a stab at that asap.

theengineear commented 5 years ago

@klebba Now that we call invalidate vs render, observers can be called before the initial render. I think we should give this a little thought. I'm not sure if it's correct or not yet.

theengineear commented 5 years ago

@klebba there were some subtle reasons why it ended up making more sense to get this and #13 merged together. I'm going to close this in favor of that.