From dc7082fbc7b48e442003650bd144deee912d9aa1 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 5 Dec 2013 19:14:59 +0000 Subject: [PATCH] Themes: when initiating a search, avoid triggering a reset event when it's not necessary. props matveb. fixes #26434. git-svn-id: https://develop.svn.wordpress.org/trunk@26685 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/theme.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/js/theme.js b/src/wp-admin/js/theme.js index 1e10a1c9c5..0505774711 100644 --- a/src/wp-admin/js/theme.js +++ b/src/wp-admin/js/theme.js @@ -129,11 +129,10 @@ themes.Collection = Backbone.Collection.extend({ // Performs a search within the collection // @uses RegExp search: function( term ) { - var self = this, - match, results, haystack; + var match, results, haystack; // Start with a full collection - self.reset( themes.data.themes ); + this.reset( themes.data.themes, { silent: true } ); // The RegExp object to match // @@ -144,7 +143,7 @@ themes.Collection = Backbone.Collection.extend({ // Find results // _.filter and .test - results = self.filter( function( data ) { + results = this.filter( function( data ) { haystack = _.union( data.get( 'name' ), data.get( 'description' ), data.get( 'author' ), data.get( 'tags' ) ); if ( match.test( data.get( 'author' ) ) ) { @@ -154,7 +153,7 @@ themes.Collection = Backbone.Collection.extend({ return match.test( haystack ); }); - self.reset( results ); + this.reset( results ); }, // Paginates the collection with a helper method