If a dialog is opened and destroyed the div used as dialogcontent will be removed from its original position and will be appended to the body. This becomes a problem when using partial page updates, because the div will move out of the scope of the update. If the update creates the div again it will exist twice now, including all the problems like not unique IDs.
I have got two ideas to fix this.
Alternative 1: Memorize the parent element Add following line to the _create function