Opened 12 years ago
Closed 12 years ago
#6719 closed enhancement (wontfix)
Autodelete for Dialogs
Reported by: | johncrenshaw | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.0 |
Component: | ui.dialog | Version: | 1.8.6 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Dialogs are likely to be created dynamically and forgotten about. We have an AJAX system that can create them as part of a response. Right now, deleting dynamic dialogs requires an explicitly crafted function to be added with every dialog. I propose adding an "autoDelete" option:
$("<div>some content</div>").dialog({autoDelete: true;});
This would cause the new elements to be removed from the DOM automatically when the dialog is closed. (Important to prevent leaks, and also to prevent ID collisions if the dialog is re-added later.)
technically backwards compatibility would require autoDelete to always default to false, however, I wonder if it makes sense to default to true iff the dialog was a fragment?
You can build this as an extension.