Fix memory leaks in data table / jqplot #11354
Prior to these changes, every data table created would remain in memory due to leftover
This PR adds a
Prerequisites to reproducing bug: Have a dashboard configured to show one of these data tables (e.g., the demo works fine for reproducing this bug).
Previously, these plugins registered a handler on the `resize` event on window, but used ad-hoc heuristics to determine when to remove the handler: * dataTable would only remove the handler the next time the `resize` event fires, which is not guaranteed to happen regularly (especially if the user is not regularly resizing their browser window, e.g., it is full screened) * Fix: I define `_destroy` on `dataTable`, which appropriately cleans up the handler (and calls the `_destroy` method of its parent class, `UIControl`) * jqplot contained code to remove the `resize` listener when `destroyPlot()` is called, but a) this function is not called when the plot is removed from the DOM (the code called `destroy()` on the `plot` object directly), and b) it incorrectly uses `this` instead of `self`, preventing it from working in the first place. * Fix: I fixed the `this`/`self` confusion, and changed the cleanup code such that `$.jqplot.visiblePlots` contains `JqplotGraphDataTable` objects rather than `jqplot` objects. These event handlers prevented previous jqplot and datatable objects from being garbage collected each time the dashboard is refreshed.
Adds code to clean up mouseup handlers on the body HTML element when data tables are destroyed. Previously, these handlers caused data tables to remain in memory forever.