Make WordPress Core

Changeset 44539


Ignore:
Timestamp:
01/10/2019 02:56:24 AM (5 years ago)
Author:
pento
Message:

Admin: Don't use the keyup event in addition to the input event.

The keyup event was used to provide support for IE8, where which doesn't support the input event. As we dropped IE8 support some time ago, this was simply adding unnecessary complexity and double-event triggers.

Props dlh, afercia.
Fixes #32882.

Location:
trunk/src/js/_enqueues
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/user-profile.js

    r43347 r44539  
    1818        $submitButtons,
    1919        $submitButton,
    20         currentPass,
    21         inputEvent;
    22 
    23     /*
    24      * Use feature detection to determine whether password inputs should use
    25      * the `keyup` or `input` event. Input is preferred but lacks support
    26      * in legacy browsers.
    27      */
    28     if ( 'oninput' in document.createElement( 'input' ) ) {
    29         inputEvent = 'input';
    30     } else {
    31         inputEvent = 'keyup';
    32     }
     20        currentPass;
    3321
    3422    function generatePassword() {
     
    7260            .data( 'pw', $pass1.data( 'pw' ) )
    7361            .val( $pass1.val() )
    74             .on( inputEvent, function () {
     62            .on( 'input', function () {
    7563                if ( $pass1Text.val() === currentPass ) {
    7664                    return;
     
    8775        }
    8876
    89         $pass1.on( inputEvent + ' pwupdate', function () {
     77        $pass1.on( 'input' + ' pwupdate', function () {
    9078            if ( $pass1.val() === currentPass ) {
    9179                return;
     
    189177         * pass2 field to the pass1 field, then running check_pass_strength.
    190178         */
    191         $pass2 = $('#pass2').on( inputEvent, function () {
     179        $pass2 = $( '#pass2' ).on( 'input', function () {
    192180            if ( $pass2.val().length > 0 ) {
    193181                $pass1.val( $pass2.val() );
     
    337325            greeting     = $( '#wp-admin-bar-my-account' ).find( '.display-name' );
    338326
    339         $('#pass1').val('').on( inputEvent + ' pwupdate', check_pass_strength );
     327        $( '#pass1' ).val( '' ).on( 'input' + ' pwupdate', check_pass_strength );
    340328        $('#pass-strength-result').show();
    341329        $('.color-palette').click( function() {
  • trunk/src/js/_enqueues/lib/nav-menu.js

    r43577 r44539  
    874874
    875875        attachQuickSearchListeners : function() {
    876             var searchTimer,
    877                 inputEvent;
     876            var searchTimer;
    878877
    879878            // Prevent form submission.
     
    882881            });
    883882
    884             /*
    885              * Use feature detection to determine whether inputs should use
    886              * the `keyup` or `input` event. Input is preferred but lacks support
    887              * in legacy browsers. See changeset 34078, see also ticket #26600#comment:59
    888              */
    889             if ( 'oninput' in document.createElement( 'input' ) ) {
    890                 inputEvent = 'input';
    891             } else {
    892                 inputEvent = 'keyup';
    893             }
    894 
    895             $( '#nav-menu-meta' ).on( inputEvent, '.quick-search', function() {
     883            $( '#nav-menu-meta' ).on( 'input', '.quick-search', function() {
    896884                var $this = $( this );
    897885
  • trunk/src/js/_enqueues/wp/customize/nav-menus.js

    r44228 r44539  
    157157        events: {
    158158            'input #menu-items-search': 'debounceSearch',
    159             'keyup #menu-items-search': 'debounceSearch',
    160159            'focus .menu-item-tpl': 'focus',
    161160            'click .menu-item-tpl': '_submit',
  • trunk/src/js/_enqueues/wp/customize/widgets.js

    r43588 r44539  
    145145        events: {
    146146            'input #widgets-search': 'search',
    147             'keyup #widgets-search': 'search',
    148147            'focus .widget-tpl' : 'focus',
    149148            'click .widget-tpl' : '_submit',
Note: See TracChangeset for help on using the changeset viewer.