Used detach() instead of empty() so event handlers would stay in place.

Props go to @whatthejeff for finding this. This fixes #50