Re: [w3c/webcomponents] The custom element state when constructor thrown (#533)

> Or, does this explicitly prevent the constructor from running twice on a specific element such that if I removed <some-element> then attached a new <some-element> then the new one will have it's constructor called?

Yes.

> Would the best practice for a library that writes a constructor like that be to encourage the failed element to be removed and for the user to try again by adding a new element?

I think the best practice would be not to rely on specific states the app may or may not be in while your constructor is running.  Keep your constructor as light as possible (only setting up its own state and tree, for instance) to avoid potential errors.  Add initialisation and cleanup routines to callbacks.

---
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/533#issuecomment-238175771

Received on Monday, 8 August 2016 22:56:52 UTC