From b5fdf3753f88ce3f1b36fb9ddabc8129beea295d Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 4 Dec 2012 22:19:08 +0000 Subject: [PATCH] In the media modal, clear attachment details when clearing the selection. Props koopersmith fixes #22718 git-svn-id: https://develop.svn.wordpress.org/trunk@23045 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/js/media-models.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-includes/js/media-models.js b/wp-includes/js/media-models.js index 120e1e5529..1883d5f18c 100644 --- a/wp-includes/js/media-models.js +++ b/wp-includes/js/media-models.js @@ -858,8 +858,14 @@ window.wp = window.wp || {}; // If single has changed, fire an event. if ( this._single !== previous ) { - if ( previous ) + if ( previous ) { previous.trigger( 'selection:unsingle', previous, this ); + + // If the model was already removed, trigger the collection + // event manually. + if ( ! this.getByCid( previous.cid ) ) + this.trigger( 'selection:unsingle', previous, this ); + } if ( this._single ) this._single.trigger( 'selection:single', this._single, this ); }