From 5c2e5e3231253222e605fb2817fa6ce9323bd65d 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: https://develop.svn.wordpress.org/trunk@22654 602fd350-edb4-49c9-b593-d223f7449a82 --- 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; },