Themes: when initiating a search, avoid triggering a reset event when it's not necessary.
props matveb. fixes #26434. Built from https://develop.svn.wordpress.org/trunk@26685 git-svn-id: http://core.svn.wordpress.org/trunk@26575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
08430e2684
commit
462d342de1
@ -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
|
||||
|
2
wp-admin/js/theme.min.js
vendored
2
wp-admin/js/theme.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user