Deferred event listener addition.

Until after elements are attached, so that removeChild followed by
appendChild doesn't leave the element with no listeners. Fixes #230.