Make `attachedCallback()` and `detachedCallback()` idempotent, so that repeated calls are ignored. Also, allow CustomElements to be attached and then detached repeated. Note: `attachedCallback()` was already made idempotent in 0d4fd79ed92d7a2e92df17333a14102674516613.