Skip to main content

Search and Top Navigation

#8195 closed bug (cantfix)

Opened March 14, 2012 08:36PM UTC

Closed March 14, 2012 08:47PM UTC

Using .replaceWith on a dialog will cause it to disappear.

Reported by: sp2 Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.dialog Version: 1.8.18
Keywords: Cc:
Blocked by: Blocking:
Description

If you call .dialog on a div, and then replace that div with .replaceWith, the old div and the new div will be removed from the DOM. I believe this has to do with the .dialog creating a wrapper div to house the dialog ui. .replaceWith attaches the new div to that wrapper, but then something happens and the whole thing gets removed.

See http://jsfiddle.net/pUrYj/12/ for example. Both buttons should replace the dialog with new content, but the one on the left causes the dialog to disappear instead. Also, this may not be isolated to just the dialog.

Attachments (0)
Change History (1)

Changed March 14, 2012 08:47PM UTC by scottgonzalez comment:1

resolution: → cantfix
status: newclosed

.replaceWith() removes the DOM element. Removing an element that a widget is initialized against will destroy the widget. Destroy a dialog removes the generated wrapper. jQuery stores a reference to the wrapper to know where to insert the new element. There's nothing we can do about this.