WordPress.org

Make WordPress Core

Changeset 38799


Ignore:
Timestamp:
10/16/16 20:02:33 (8 months ago)
Author:
afercia
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/nav-menu.js

    r38770 r38799  
    888888            } 
    889889 
    890             $( '.quick-search' ).on( inputEvent, function() { 
    891                 var t = $(this); 
    892  
    893                 if( searchTimer ) clearTimeout(searchTimer); 
    894  
    895                 searchTimer = setTimeout(function(){ 
    896                     api.updateQuickSearchResults( t ); 
    897                 }, 500 ); 
    898             }).on( 'blur', function() { 
     890            $( '#nav-menu-meta' ).on( inputEvent, '.quick-search', function() { 
     891                var $this = $( this ); 
     892 
     893                $this.attr( 'autocomplete', 'off' ); 
     894 
     895                if ( searchTimer ) { 
     896                    clearTimeout( searchTimer ); 
     897                } 
     898 
     899                searchTimer = setTimeout( function() { 
     900                    api.updateQuickSearchResults( $this ); 
     901                }, 500 ); 
     902            }).on( 'blur', '.quick-search', function() { 
    899903                api.lastSearch = ''; 
    900             }).attr('autocomplete','off'); 
     904            }); 
    901905        }, 
    902906 
Note: See TracChangeset for help on using the changeset viewer.