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.

Built from https://develop.svn.wordpress.org/trunk@38799


git-svn-id: http://core.svn.wordpress.org/trunk@38742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2016-10-16 20:03:29 +00:00
parent 4a95bfa4c2
commit 8aef143d80
3 changed files with 14 additions and 10 deletions

View File

@ -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 );
}, 500 ); }
}).on( 'blur', function() {
searchTimer = setTimeout( function() {
api.updateQuickSearchResults( $this );
}, 500 );
}).on( 'blur', '.quick-search', function() {
api.lastSearch = ''; api.lastSearch = '';
}).attr('autocomplete','off'); });
}, },
updateQuickSearchResults : function(input) { updateQuickSearchResults : function(input) {

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7-alpha-38798'; $wp_version = '4.7-alpha-38799';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.