mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 19:46:21 +00:00
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:
parent
12c21bf931
commit
2441d98446
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user