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:
parent
fb7e12b9ad
commit
95feac1df5
|
@ -887,17 +887,21 @@ var wpNavMenu;
|
||||||
inputEvent = 'keyup';
|
inputEvent = 'keyup';
|
||||||
}
|
}
|
||||||
|
|
||||||
$( '.quick-search' ).on( inputEvent, function() {
|
$( '#nav-menu-meta' ).on( inputEvent, '.quick-search', function() {
|
||||||
var t = $(this);
|
var $this = $( this );
|
||||||
|
|
||||||
if( searchTimer ) clearTimeout(searchTimer);
|
$this.attr( 'autocomplete', 'off' );
|
||||||
|
|
||||||
searchTimer = setTimeout(function(){
|
if ( searchTimer ) {
|
||||||
api.updateQuickSearchResults( t );
|
clearTimeout( searchTimer );
|
||||||
|
}
|
||||||
|
|
||||||
|
searchTimer = setTimeout( function() {
|
||||||
|
api.updateQuickSearchResults( $this );
|
||||||
}, 500 );
|
}, 500 );
|
||||||
}).on( 'blur', function() {
|
}).on( 'blur', '.quick-search', function() {
|
||||||
api.lastSearch = '';
|
api.lastSearch = '';
|
||||||
}).attr('autocomplete','off');
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
updateQuickSearchResults : function(input) {
|
updateQuickSearchResults : function(input) {
|
||||||
|
|
Loading…
Reference in New Issue