Prevent JS events from being garbage collected when a media.view.Modal is re-rendered. see #21390, #21776.

git-svn-id: https://develop.svn.wordpress.org/trunk@21771 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith
2012-09-06 09:19:03 +00:00
parent 3ef72a1dee
commit 8085c5ac5a

View File

@@ -101,6 +101,13 @@
},
render: function() {
// Ensure content div exists.
this.options.$content = this.options.$content || $('<div />');
// Detach the content element from the DOM to prevent
// `this.$el.html()` from garbage collecting its events.
this.options.$content.detach();
this.$el.html( this.template( this.options ) );
this.$('.media-modal-content').append( this.options.$content );
return this;