From 88f09f7118eedefbc4e987fdbdca2dceebf7d4e0 Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Mon, 19 Nov 2012 02:00:01 +0000 Subject: [PATCH] Media: Remove redundant sorting logic from composite models. see #21390. git-svn-id: http://core.svn.wordpress.org/trunk@22654 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/media-models.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/wp-includes/js/media-models.js b/wp-includes/js/media-models.js index a50edf4210..8f73ff479f 100644 --- a/wp-includes/js/media-models.js +++ b/wp-includes/js/media-models.js @@ -747,16 +747,11 @@ window.wp = window.wp || {}; var valid = this.validator( attachment ), hasAttachment = !! this.getByCid( attachment.cid ); - if ( ! valid && hasAttachment ) { + if ( ! valid && hasAttachment ) this.remove( attachment, options ); - } else if ( valid && ! hasAttachment ) { + else if ( valid && ! hasAttachment ) this.add( attachment, options ); - // If we haven't been silenced, resort the collection. - if ( this.comparator && ( ! options || ! options.silent ) ) - this.sort({ silent: true }); - } - return this; }, @@ -769,8 +764,6 @@ window.wp = window.wp || {}; this.evaluate( attachment, { silent: true }); }, this ); - if ( this.comparator ) - this.sort( options ); return this; },