When a tab is closed, it cleans out the body div in the DOM before firing the removed event.
As a result, any jqWidgets used in the tab body are removed before they can be manually ‘destroyed’ by a handler.
Does the tab component do any intelligent checking of the children of the body div upon closing? If not, will the undestroyed but removed widgets cause a memory leak in a single page app where many tabs are opened and closed over time (with dynamic tab contents and different ‘id’s for the widgets on each new tab)?
I can see that there are bindings in the widgets, but are there data structures which will not be garbage collected if the widgets are removed from the DOM but not ‘destroyed’?
(I guess this is as much a question about ‘destroy’ in jqWidgets as it is about tabs.)
With the addition of a ‘removing’ event to your tab component, I could manually clean up the tab contents and destroy any dropdown lists, calendars, etc. in the tab bodies before the tab is closed and this wouldn’t be an issue.