Menus: Fix the posts-categories quick search.

On the Menus screen, events that trigger the posts-categories search need to be
delegated. This "boxes" may get dynamically rebuilt so events directly attached
to the search input field need to be delegated.

Fixes #38324.


git-svn-id: https://develop.svn.wordpress.org/trunk@38799 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia 2016-10-16 20:02:33 +00:00
parent fb7e12b9ad
commit 95feac1df5
1 changed files with 12 additions and 8 deletions

View File

@ -887,17 +887,21 @@ var wpNavMenu;
inputEvent = 'keyup';
}
$( '.quick-search' ).on( inputEvent, function() {
var t = $(this);
$( '#nav-menu-meta' ).on( inputEvent, '.quick-search', function() {
var $this = $( this );
if( searchTimer ) clearTimeout(searchTimer);
$this.attr( 'autocomplete', 'off' );
searchTimer = setTimeout(function(){
api.updateQuickSearchResults( t );
}, 500 );
}).on( 'blur', function() {
if ( searchTimer ) {
clearTimeout( searchTimer );
}
searchTimer = setTimeout( function() {
api.updateQuickSearchResults( $this );
}, 500 );
}).on( 'blur', '.quick-search', function() {
api.lastSearch = '';
}).attr('autocomplete','off');
});
},
updateQuickSearchResults : function(input) {