Ensures dialogs are immediately removed from DOM when closed.
Previously, dialogs were destroyed but not removed causing possibility of duplicate element IDs, so jQuery unitentionally selects and recreates old dialogs, thus GUI._updateOkButtonStatus updates the wrong button.
Old behaviour of ._downloadRegisteredResources attempts to download all registered resources, regardless of whether they have been previously downloaded. howler.js appears to ignore requests to re-download, however PreloadJS will redownload, which can cause critical errors if a resource is being used while being unnecessarily redownloaded
Now use a Map to keep track of individual elements to prevent duplication.
Previously would increment continuously just by switching dropdown options. So users could bypass the requirement to complete starred(*) fields by toggling a dropdown a few times, or by focussing and unfocussing input elements, causing nbSetRequiredKeys++ to increment without limit.
GlobalEventHandlers.onchange only fires when focus is lost. However .oninput fires whenever contents are modified. Original requires "double click" behaviour: first click to deselect the input element, second click to actually click the "Ok" button. Old code results in "Ok" buttons remaining visually disabled thus confusing users even when input elements have been completed