Make WordPress Core

Ticket #32882: 32882.2.diff

File 32882.2.diff, 4.0 KB (added by afercia, 7 years ago)
  • src/js/_enqueues/admin/user-profile.js

     
    1717                $toggleButton,
    1818                $submitButtons,
    1919                $submitButton,
    20                 currentPass,
    21                 inputEvent;
     20                currentPass;
    2221
    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         }
    33 
    3422        function generatePassword() {
    3523                if ( typeof zxcvbn !== 'function' ) {
    3624                        setTimeout( generatePassword, 50 );
     
    7159                        .addClass( $pass1[0].className )
    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;
    7765                                }
     
    8674                        generatePassword();
    8775                }
    8876
    89                 $pass1.on( inputEvent + ' pwupdate', function () {
     77                $pass1.on( 'input' + ' pwupdate', function () {
    9078                        if ( $pass1.val() === currentPass ) {
    9179                                return;
    9280                        }
     
    188176                 * This fixes the issue by copying any changes from the hidden
    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() );
    194182                                $pass2.val('');
     
    336324                        current_name = select.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() {
    342330                        $(this).siblings('input[name="admin_color"]').prop('checked', true);
  • src/js/_enqueues/lib/nav-menu.js

     
    873873                },
    874874
    875875                attachQuickSearchListeners : function() {
    876                         var searchTimer,
    877                                 inputEvent;
     876                        var searchTimer;
    878877
    879878                        // Prevent form submission.
    880879                        $( '#nav-menu-meta' ).on( 'submit', function( event ) {
     
    881880                                event.preventDefault();
    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
    898886                                $this.attr( 'autocomplete', 'off' );
  • src/js/_enqueues/wp/customize/nav-menus.js

     
    156156
    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',
    162161                        'click #custom-menu-item-submit': '_submitLink',
  • src/js/_enqueues/wp/customize/widgets.js

     
    144144
    145145                events: {
    146146                        'input #widgets-search': 'search',
    147                         'keyup #widgets-search': 'search',
    148147                        'focus .widget-tpl' : 'focus',
    149148                        'click .widget-tpl' : '_submit',
    150149                        'keypress .widget-tpl' : '_submit',