Use boundingClientRect instead of offsetTop/Height.
Clean up properly when table is removed from DOM.