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

git-svn-id: http://core.svn.wordpress.org/trunk@21771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Daryl Koopersmith 2012-09-06 09:19:03 +00:00
parent 12c21bf931
commit 2441d98446

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;