Make WordPress Core

Changeset 21771


Ignore:
Timestamp:
09/06/2012 09:19:03 AM (14 years ago)
Author:
koopersmith
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/media-views.js

    r21769 r21771  
    102102
    103103                render: function() {
     104                        // Ensure content div exists.
     105                        this.options.$content = this.options.$content || $('<div />');
     106
     107                        // Detach the content element from the DOM to prevent
     108                        // `this.$el.html()` from garbage collecting its events.
     109                        this.options.$content.detach();
     110
    104111                        this.$el.html( this.template( this.options ) );
    105112                        this.$('.media-modal-content').append( this.options.$content );
Note: See TracChangeset for help on using the changeset viewer.