Themes: improve search by trimming search string.
Fix an issue where searching installed themes for an empty string resulted in matching all themes. Props afercia, desrosj, hesyifei, evalarumbe. Fixes #39041. git-svn-id: https://develop.svn.wordpress.org/trunk@45557 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e9fc71bbbe
commit
0dc3295e29
@ -180,6 +180,9 @@ themes.Collection = Backbone.Collection.extend({
|
|||||||
// Start with a full collection
|
// Start with a full collection
|
||||||
this.reset( themes.data.themes, { silent: true } );
|
this.reset( themes.data.themes, { silent: true } );
|
||||||
|
|
||||||
|
// Trim the term
|
||||||
|
term = term.trim();
|
||||||
|
|
||||||
// Escape the term string for RegExp meta characters
|
// Escape the term string for RegExp meta characters
|
||||||
term = term.replace( /[-\/\\^$*+?.()|[\]{}]/g, '\\$&' );
|
term = term.replace( /[-\/\\^$*+?.()|[\]{}]/g, '\\$&' );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user