Make WordPress Core

Changeset 50001


Ignore:
Timestamp:
01/22/2021 12:30:39 PM (4 years ago)
Author:
SergeyBiryukov
Message:

External Libraries: First pass at fixing jQuery deprecations in WordPress core and bundled themes.

To be able to disable jQuery Migrate as step 3 of updating the jQuery version shipped with WordPress, all JQMIGRATE warnings in the browser console will have to be addressed.

This includes many minor adjustments to a wide array of core files.

Follow-up to:

Props Clorith, azaozz.
See #51812.

Location:
trunk/src
Files:
44 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/application-passwords.js

    r49716 r50001  
    1616        userId = $( '#user_id' ).val();
    1717
    18     $newAppPassButton.click( function( e ) {
     18    $newAppPassButton.on( 'click', function( e ) {
    1919        e.preventDefault();
    2020
  • trunk/src/js/_enqueues/admin/comment.js

    r48395 r50001  
    3030     * @return {void}
    3131     */
    32     $edittimestamp.click( function( event ) {
     32    $edittimestamp.on( 'click', function( event ) {
    3333        if ( $timestampdiv.is( ':hidden' ) ) {
    3434            // Slide down the form and set focus on the first field.
    3535            $timestampdiv.slideDown( 'fast', function() {
    36                 $( 'input, select', $timestampwrap ).first().focus();
     36                $( 'input, select', $timestampwrap ).first().trigger( 'focus' );
    3737            } );
    3838            $(this).hide();
     
    5050     */
    5151
    52     $timestampdiv.find('.cancel-timestamp').click( function( event ) {
     52    $timestampdiv.find('.cancel-timestamp').on( 'click', function( event ) {
    5353        // Move focus back to the Edit link.
    54         $edittimestamp.show().focus();
     54        $edittimestamp.show().trigger( 'focus' );
    5555        $timestampdiv.slideUp( 'fast' );
    5656        $('#mm').val($('#hidden_mm').val());
     
    7171     * @return {void}
    7272     */
    73     $timestampdiv.find('.save-timestamp').click( function( event ) { // Crazyhorse - multiple OK cancels.
     73    $timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse - multiple OK cancels.
    7474        var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(),
    7575            newD = new Date( aa, mm - 1, jj, hh, mn );
     
    9797
    9898        // Move focus back to the Edit link.
    99         $edittimestamp.show().focus();
     99        $edittimestamp.show().trigger( 'focus' );
    100100        $timestampdiv.slideUp( 'fast' );
    101101    });
  • trunk/src/js/_enqueues/admin/common.js

    r49944 r50001  
    383383    init : function() {
    384384        var that = this;
    385         $('.hide-column-tog', '#adv-settings').click( function() {
     385        $('.hide-column-tog', '#adv-settings').on( 'click', function() {
    386386            var $t = $(this), column = $t.val();
    387387            if ( $t.prop('checked') )
     
    501501        .addClass( 'form-invalid' )
    502502        .find( ':input:visible' )
    503         .change( function() { $( this ).closest( '.form-invalid' ).removeClass( 'form-invalid' ); } )
     503        .on( 'change', function() { $( this ).closest( '.form-invalid' ).removeClass( 'form-invalid' ); } )
    504504        .length;
    505505};
     
    572572        this.page    = $('#wpcontent');
    573573
    574         this.toggles.click( this.toggleEvent );
     574        this.toggles.on( 'click', this.toggleEvent );
    575575    },
    576576
     
    618618         */
    619619        panel.slideDown( 'fast', function() {
    620             panel.focus();
     620            panel.trigger( 'focus' );
    621621            button.addClass( 'screen-meta-active' ).attr( 'aria-expanded', true );
    622622        });
     
    660660 * @return {void}
    661661 */
    662 $('.contextual-help-tabs').delegate('a', 'click', function(e) {
     662$('.contextual-help-tabs').on( 'click', 'a', function(e) {
    663663    var link = $(this),
    664664        panel;
     
    799799        newSelectionStart = ( permalinkStructureValue.substr( 0, selectionStart ) + textToAppend ).length;
    800800        $permalinkStructure[0].setSelectionRange( newSelectionStart, newSelectionStart );
    801         $permalinkStructure.focus();
     801        $permalinkStructure.trigger( 'focus' );
    802802    }
    803803} );
     
    13031303    });
    13041304
    1305     $('#default-password-nag-no').click( function() {
     1305    $('#default-password-nag-no').on( 'click', function() {
    13061306        setUserSetting('default_password_nag', 'hide');
    13071307        $('div.default-password-nag').hide();
     
    13161316     * @return {void}
    13171317     */
    1318     $('#newcontent').bind('keydown.wpevent_InsertTab', function(e) {
     1318    $('#newcontent').on('keydown.wpevent_InsertTab', function(e) {
    13191319        var el = e.target, selStart, selEnd, val, scroll, sel;
    13201320
     
    13751375         * @return {void}
    13761376         */
    1377         pageInput.closest('form').submit( function() {
     1377        pageInput.closest('form').on( 'submit', function() {
    13781378            /*
    13791379             * action = bulk action dropdown at the top of the table
     
    13891389     * @return {void}
    13901390     */
    1391     $('.search-box input[type="search"], .search-box input[type="submit"]').mousedown(function () {
     1391    $('.search-box input[type="search"], .search-box input[type="submit"]').on( 'mousedown', function () {
    13921392        $('select[name^="action"]').val('-1');
    13931393    });
     
    16901690                if ( $wpwrap.hasClass( 'wp-responsive-open' ) ) {
    16911691                    $(this).find('a').attr( 'aria-expanded', 'true' );
    1692                     $( '#adminmenu a:first' ).focus();
     1692                    $( '#adminmenu a:first' ).trigger( 'focus' );
    16931693                } else {
    16941694                    $(this).find('a').attr( 'aria-expanded', 'false' );
     
    19791979
    19801980    // Set initial focus on a specific element.
    1981     $( '.wp-initial-focus' ).focus();
     1981    $( '.wp-initial-focus' ).trigger( 'focus' );
    19821982
    19831983    // Toggle update details on update-core.php.
  • trunk/src/js/_enqueues/admin/edit-comments.js

    r49944 r50001  
    446446            $('.avatar', el).first().clone().prependTo('#undo-' + id + ' .' + action + '-undo-inside');
    447447
    448             a.click(function( e ){
     448            a.on( 'click', function( e ){
    449449                e.preventDefault();
    450450                e.stopPropagation(); // Ticket #35904.
     
    763763     */
    764764    window.theList = $('#the-comment-list').wpList( { alt: '', delBefore: delBefore, dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } )
    765         .bind('wpListDelEnd', function(e, s){
     765        .on('wpListDelEnd', function(e, s){
    766766            var wpListsData = $(s.target).attr('data-wp-lists'), id = s.element.replace(/[^0-9]+/g, '');
    767767
     
    794794        var row = $('#replyrow');
    795795
    796         $( '.cancel', row ).click( function() { return commentReply.revert(); } );
    797         $( '.save', row ).click( function() { return commentReply.send(); } );
    798         $( 'input#author-name, input#author-email, input#author-url', row ).keypress( function( e ) {
     796        $( '.cancel', row ).on( 'click', function() { return commentReply.revert(); } );
     797        $( '.save', row ).on( 'click', function() { return commentReply.send(); } );
     798        $( 'input#author-name, input#author-email, input#author-url', row ).on( 'keypress', function( e ) {
    799799            if ( e.which == 13 ) {
    800800                commentReply.send();
     
    805805
    806806        // Add events.
    807         $('#the-comment-list .column-comment > p').dblclick(function(){
     807        $('#the-comment-list .column-comment > p').on( 'dblclick', function(){
    808808            commentReply.toggle($(this).parent());
    809809        });
    810810
    811         $('#doaction, #post-query-submit').click(function(){
     811        $('#doaction, #post-query-submit').on( 'click', function(){
    812812            if ( $('#the-comment-list #replyrow').length > 0 )
    813813                commentReply.close();
     
    832832    addEvents : function(r) {
    833833        r.each(function() {
    834             $(this).find('.column-comment > p').dblclick(function(){
     834            $(this).find('.column-comment > p').on( 'dblclick', function(){
    835835                commentReply.toggle($(this).parent());
    836836            });
     
    906906                    .find( '.vim-q' )
    907907                        .attr( 'aria-expanded', 'false' )
    908                         .focus();
     908                        .trigger( 'focus' );
    909909            } ).css( 'backgroundColor', '' );
    910910        }
     
    914914            commentRow.find( '.vim-r' )
    915915                .attr( 'aria-expanded', 'false' )
    916                 .focus();
     916                .trigger( 'focus' );
    917917        }
    918918
     
    10331033                window.scroll(0, rtop - 35);
    10341034
    1035             $('#replycontent').focus().keyup(function(e){
     1035            $('#replycontent').trigger( 'focus' ).on( 'keyup', function(e){
    10361036                if ( e.which == 27 )
    10371037                    commentReply.revert(); // Close on Escape.
     
    11361136        }
    11371137
    1138         c = $.trim(r.data); // Trim leading whitespaces.
     1138        r.data = r.data || '';
     1139        c = r.data.toString().trim(); // Trim leading whitespaces.
    11391140        $(c).hide();
    11401141        $('#replyrow').after(c);
  • trunk/src/js/_enqueues/admin/inline-edit-post.js

    r49944 r50001  
    5252         * @return {boolean} The result of revert.
    5353         */
    54         qeRow.keyup(function(e){
     54        qeRow.on( 'keyup', function(e){
    5555            // Revert changes if Escape key is pressed.
    5656            if ( e.which === 27 ) {
     
    6464         * @return {boolean} The result of revert.
    6565         */
    66         bulkRow.keyup(function(e){
     66        bulkRow.on( 'keyup', function(e){
    6767            // Revert changes if Escape key is pressed.
    6868            if ( e.which === 27 ) {
     
    7676         * @return {boolean} The result of revert.
    7777         */
    78         $( '.cancel', qeRow ).click( function() {
     78        $( '.cancel', qeRow ).on( 'click', function() {
    7979            return inlineEditPost.revert();
    8080        });
     
    8585         * @return {boolean} The result of save.
    8686         */
    87         $( '.save', qeRow ).click( function() {
     87        $( '.save', qeRow ).on( 'click', function() {
    8888            return inlineEditPost.save(this);
    8989        });
     
    9494         * @return {boolean} The result of save.
    9595         */
    96         $('td', qeRow).keydown(function(e){
     96        $('td', qeRow).on( 'keydown', function(e){
    9797            if ( e.which === 13 && ! $( e.target ).hasClass( 'cancel' ) ) {
    9898                return inlineEditPost.save(this);
     
    105105         * @return {boolean} The result of revert.
    106106         */
    107         $( '.cancel', bulkRow ).click( function() {
     107        $( '.cancel', bulkRow ).on( 'click', function() {
    108108            return inlineEditPost.revert();
    109109        });
     
    112112         * Disables the password input field when the private post checkbox is checked.
    113113         */
    114         $('#inline-edit .inline-edit-private input[value="private"]').click( function(){
     114        $('#inline-edit .inline-edit-private input[value="private"]').on( 'click', function(){
    115115            var pw = $('input.inline-edit-password-input');
    116116            if ( $(this).prop('checked') ) {
     
    140140         * Adds onclick events to the apply buttons.
    141141         */
    142         $('#doaction').click(function(e){
     142        $('#doaction').on( 'click', function(e){
    143143            var n;
    144144
     
    216216         * @listens click
    217217         */
    218         $('#bulk-titles a').click(function(){
     218        $('#bulk-titles a').on( 'click', function(){
    219219            var id = $(this).attr('id').substr(1);
    220220
     
    384384
    385385        $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
    386         $('.ptitle', editRow).focus();
     386        $('.ptitle', editRow).trigger( 'focus' );
    387387
    388388        return false;
     
    435435                            $( this ).find( '.editinline' )
    436436                                .attr( 'aria-expanded', 'false' )
    437                                 .focus();
     437                                .trigger( 'focus' );
    438438                            wp.a11y.speak( wp.i18n.__( 'Changes saved.' ) );
    439439                        });
     
    482482
    483483                // Move focus back to the Bulk Action button that was activated.
    484                 $( '#' + inlineEditPost.whichBulkButtonId ).focus();
     484                $( '#' + inlineEditPost.whichBulkButtonId ).trigger( 'focus' );
    485485            } else {
    486486
     
    492492                $( this.what + id ).show().find( '.editinline' )
    493493                    .attr( 'aria-expanded', 'false' )
    494                     .focus();
     494                    .trigger( 'focus' );
    495495            }
    496496        }
  • trunk/src/js/_enqueues/admin/inline-edit-tax.js

    r48391 r50001  
    4848         * @param {Object} e The keyup event that has been triggered.
    4949         */
    50         row.keyup( function( e ) {
     50        row.on( 'keyup', function( e ) {
    5151            // 27 = [Escape].
    5252            if ( e.which === 27 ) {
     
    5858         * Cancels inline editing when clicking the cancel button.
    5959         */
    60         $( '.cancel', row ).click( function() {
     60        $( '.cancel', row ).on( 'click', function() {
    6161            return inlineEditTax.revert();
    6262        });
     
    6565         * Saves the inline edits when clicking the save button.
    6666         */
    67         $( '.save', row ).click( function() {
     67        $( '.save', row ).on( 'click', function() {
    6868            return inlineEditTax.save(this);
    6969        });
     
    7272         * Saves the inline edits when pressing Enter inside the inline editor.
    7373         */
    74         $( 'input, select', row ).keydown( function( e ) {
     74        $( 'input, select', row ).on( 'keydown', function( e ) {
    7575            // 13 = [Enter].
    7676            if ( e.which === 13 ) {
     
    8282         * Saves the inline edits on submitting the inline edit form.
    8383         */
    84         $( '#posts-filter input[type="submit"]' ).mousedown( function() {
     84        $( '#posts-filter input[type="submit"]' ).on( 'mousedown', function() {
    8585            t.revert();
    8686        });
     
    144144
    145145        $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
    146         $('.ptitle', editRow).eq(0).focus();
     146        $('.ptitle', editRow).eq(0).trigger( 'focus' );
    147147
    148148        return false;
     
    224224                            row.find( '.editinline' )
    225225                                .attr( 'aria-expanded', 'false' )
    226                                 .focus();
     226                                .trigger( 'focus' );
    227227                            wp.a11y.speak( wp.i18n.__( 'Changes saved.' ) );
    228228                        });
     
    269269            $( this.what + id ).show().find( '.editinline' )
    270270                .attr( 'aria-expanded', 'false' )
    271                 .focus();
     271                .trigger( 'focus' );
    272272        }
    273273    },
  • trunk/src/js/_enqueues/admin/media-upload.js

    r47122 r50001  
    109109
    110110    // Add handler to recalculates the ThickBox position when the window is resized.
    111     $(window).resize(function(){ tb_position(); });
     111    $(window).on( 'resize', function(){ tb_position(); });
    112112
    113113})(jQuery);
  • trunk/src/js/_enqueues/admin/media.js

    r49944 r50001  
    159159
    160160        // Prevents form submission if no post has been selected.
    161         $( '#find-posts-submit' ).click( function( event ) {
     161        $( '#find-posts-submit' ).on( 'click', function( event ) {
    162162            if ( ! $( '#find-posts-response input[type="radio"]:checked' ).length )
    163163                event.preventDefault();
     
    165165
    166166        // Submits the search query when hitting the enter key in the search input.
    167         $( '#find-posts .find-box-search :input' ).keypress( function( event ) {
     167        $( '#find-posts .find-box-search :input' ).on( 'keypress', function( event ) {
    168168            if ( 13 == event.which ) {
    169169                findPosts.send();
     
    173173
    174174        // Binds the click event to the search button.
    175         $( '#find-posts-search' ).click( findPosts.send );
     175        $( '#find-posts-search' ).on( 'click', findPosts.send );
    176176
    177177        // Binds the close dialog click event.
    178         $( '#find-posts-close' ).click( findPosts.close );
     178        $( '#find-posts-close' ).on( 'click', findPosts.close );
    179179
    180180        // Binds the bulk action events to the submit buttons.
    181         $( '#doaction' ).click( function( event ) {
     181        $( '#doaction' ).on( 'click', function( event ) {
    182182
    183183            /*
  • trunk/src/js/_enqueues/admin/plugin-install.js

    r48392 r50001  
    5151    };
    5252
    53     $( window ).resize( function() {
     53    $( window ).on( 'resize', function() {
    5454        tb_position();
    5555    });
     
    186186
    187187    /* Plugin install related JS */
    188     $( '#plugin-information-tabs a' ).click( function( event ) {
     188    $( '#plugin-information-tabs a' ).on( 'click', function( event ) {
    189189        var tab = $( this ).attr( 'name' );
    190190        event.preventDefault();
  • trunk/src/js/_enqueues/admin/post.js

    r49807 r50001  
    214214
    215215                    wrap.show().find('.currently-editing').text( received.lock_error.text );
    216                     wrap.find('.wp-tab-first').focus();
     216                    wrap.find('.wp-tab-first').trigger( 'focus' );
    217217                }
    218218            } else if ( received.new_lock ) {
     
    328328        // [Shift] + [Tab] on first tab cycles back to last tab.
    329329        if ( target.hasClass('wp-tab-first') && e.shiftKey ) {
    330             $(this).find('.wp-tab-last').focus();
     330            $(this).find('.wp-tab-last').trigger( 'focus' );
    331331            e.preventDefault();
    332332        // [Tab] on last tab cycles back to first tab.
    333333        } else if ( target.hasClass('wp-tab-last') && ! e.shiftKey ) {
    334             $(this).find('.wp-tab-first').focus();
     334            $(this).find('.wp-tab-first').trigger( 'focus' );
    335335            e.preventDefault();
    336336        }
    337     }).filter(':visible').find('.wp-tab-first').focus();
     337    }).filter(':visible').find('.wp-tab-first').trigger( 'focus' );
    338338
    339339    // Set the heartbeat interval to 15 seconds if post lock dialogs are enabled.
     
    438438                editor.focus();
    439439            } else if ( $textarea.length ) {
    440                 $textarea.focus();
     440                $textarea.trigger( 'focus' );
    441441            } else {
    442442                return;
     
    579579
    580580        // @todo Move to jQuery 1.3+, support for multiple hierarchical taxonomies, see wp-lists.js.
    581         $('a', '#' + taxonomy + '-tabs').click( function( e ) {
     581        $('a', '#' + taxonomy + '-tabs').on( 'click', function( e ) {
    582582            e.preventDefault();
    583583            var t = $(this).attr('href');
     
    609609
    610610        // After submitting a new taxonomy, re-focus the input field.
    611         $('#' + taxonomy + '-add-submit').click( function() {
    612             $('#new' + taxonomy).focus();
     611        $('#' + taxonomy + '-add-submit').on( 'click', function() {
     612            $('#new' + taxonomy).trigger( 'focus' );
    613613        });
    614614
     
    659659
    660660        // Add new taxonomy button toggles input form visibility.
    661         $('#' + taxonomy + '-add-toggle').click( function( e ) {
     661        $('#' + taxonomy + '-add-toggle').on( 'click', function( e ) {
    662662            e.preventDefault();
    663663            $('#' + taxonomy + '-adder').toggleClass( 'wp-hidden-children' );
    664664            $('a[href="#' + taxonomy + '-all"]', '#' + taxonomy + '-tabs').click();
    665             $('#new'+taxonomy).focus();
     665            $('#new'+taxonomy).trigger( 'focus' );
    666666        });
    667667
     
    835835
    836836        // Show the visibility options and hide the toggle button when opened.
    837         $( '#visibility .edit-visibility').click( function( e ) {
     837        $( '#visibility .edit-visibility').on( 'click', function( e ) {
    838838            e.preventDefault();
    839839            if ( $postVisibilitySelect.is(':hidden') ) {
    840840                updateVisibility();
    841841                $postVisibilitySelect.slideDown( 'fast', function() {
    842                     $postVisibilitySelect.find( 'input[type="radio"]' ).first().focus();
     842                    $postVisibilitySelect.find( 'input[type="radio"]' ).first().trigger( 'focus' );
    843843                } );
    844844                $(this).hide();
     
    847847
    848848        // Cancel visibility selection area and hide it from view.
    849         $postVisibilitySelect.find('.cancel-post-visibility').click( function( event ) {
     849        $postVisibilitySelect.find('.cancel-post-visibility').on( 'click', function( event ) {
    850850            $postVisibilitySelect.slideUp('fast');
    851851            $('#visibility-radio-' + $('#hidden-post-visibility').val()).prop('checked', true);
     
    853853            $('#sticky').prop('checked', $('#hidden-post-sticky').prop('checked'));
    854854            $('#post-visibility-display').html(visibility);
    855             $('#visibility .edit-visibility').show().focus();
     855            $('#visibility .edit-visibility').show().trigger( 'focus' );
    856856            updateText();
    857857            event.preventDefault();
     
    859859
    860860        // Set the selected visibility as current.
    861         $postVisibilitySelect.find('.save-post-visibility').click( function( event ) { // Crazyhorse - multiple OK cancels.
     861        $postVisibilitySelect.find('.save-post-visibility').on( 'click', function( event ) { // Crazyhorse - multiple OK cancels.
    862862            var visibilityLabel = '', selectedVisibility = $postVisibilitySelect.find('input:radio:checked').val();
    863863
    864864            $postVisibilitySelect.slideUp('fast');
    865             $('#visibility .edit-visibility').show().focus();
     865            $('#visibility .edit-visibility').show().trigger( 'focus' );
    866866            updateText();
    867867
     
    887887
    888888        // When the selection changes, update labels.
    889         $postVisibilitySelect.find('input:radio').change( function() {
     889        $postVisibilitySelect.find('input:radio').on( 'change', function() {
    890890            updateVisibility();
    891891        });
    892892
    893893        // Edit publish time click.
    894         $timestampdiv.siblings('a.edit-timestamp').click( function( event ) {
     894        $timestampdiv.siblings('a.edit-timestamp').on( 'click', function( event ) {
    895895            if ( $timestampdiv.is( ':hidden' ) ) {
    896896                $timestampdiv.slideDown( 'fast', function() {
    897                     $( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().focus();
     897                    $( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().trigger( 'focus' );
    898898                } );
    899899                $(this).hide();
     
    903903
    904904        // Cancel editing the publish time and hide the settings.
    905         $timestampdiv.find('.cancel-timestamp').click( function( event ) {
    906             $timestampdiv.slideUp('fast').siblings('a.edit-timestamp').show().focus();
     905        $timestampdiv.find('.cancel-timestamp').on( 'click', function( event ) {
     906            $timestampdiv.slideUp('fast').siblings('a.edit-timestamp').show().trigger( 'focus' );
    907907            $('#mm').val($('#hidden_mm').val());
    908908            $('#jj').val($('#hidden_jj').val());
     
    915915
    916916        // Save the changed timestamp.
    917         $timestampdiv.find('.save-timestamp').click( function( event ) { // Crazyhorse - multiple OK cancels.
     917        $timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse - multiple OK cancels.
    918918            if ( updateText() ) {
    919919                $timestampdiv.slideUp('fast');
    920                 $timestampdiv.siblings('a.edit-timestamp').show().focus();
     920                $timestampdiv.siblings('a.edit-timestamp').show().trigger( 'focus' );
    921921            }
    922922            event.preventDefault();
     
    938938
    939939        // Post Status edit click.
    940         $postStatusSelect.siblings('a.edit-post-status').click( function( event ) {
     940        $postStatusSelect.siblings('a.edit-post-status').on( 'click', function( event ) {
    941941            if ( $postStatusSelect.is( ':hidden' ) ) {
    942942                $postStatusSelect.slideDown( 'fast', function() {
    943                     $postStatusSelect.find('select').focus();
     943                    $postStatusSelect.find('select').trigger( 'focus' );
    944944                } );
    945945                $(this).hide();
     
    949949
    950950        // Save the Post Status changes and hide the options.
    951         $postStatusSelect.find('.save-post-status').click( function( event ) {
    952             $postStatusSelect.slideUp( 'fast' ).siblings( 'a.edit-post-status' ).show().focus();
     951        $postStatusSelect.find('.save-post-status').on( 'click', function( event ) {
     952            $postStatusSelect.slideUp( 'fast' ).siblings( 'a.edit-post-status' ).show().trigger( 'focus' );
    953953            updateText();
    954954            event.preventDefault();
     
    956956
    957957        // Cancel Post Status editing and hide the options.
    958         $postStatusSelect.find('.cancel-post-status').click( function( event ) {
    959             $postStatusSelect.slideUp( 'fast' ).siblings( 'a.edit-post-status' ).show().focus();
     958        $postStatusSelect.find('.cancel-post-status').on( 'click', function( event ) {
     959            $postStatusSelect.slideUp( 'fast' ).siblings( 'a.edit-post-status' ).show().trigger( 'focus' );
    960960            $('#post_status').val( $('#hidden_post_status').val() );
    961961            updateText();
     
    998998
    999999        // Save permalink changes.
    1000         buttons.children( '.save' ).click( function() {
     1000        buttons.children( '.save' ).on( 'click', function() {
    10011001            var new_slug = $el.children( 'input' ).val();
    10021002
     
    10271027                    permalink.html(permalinkOrig);
    10281028                    real_slug.val(new_slug);
    1029                     $( '.edit-slug' ).focus();
     1029                    $( '.edit-slug' ).trigger( 'focus' );
    10301030                    wp.a11y.speak( __( 'Permalink saved' ) );
    10311031                }
     
    10341034
    10351035        // Cancel editing of permalink.
    1036         buttons.children( '.cancel' ).click( function() {
     1036        buttons.children( '.cancel' ).on( 'click', function() {
    10371037            $('#view-post-btn').show();
    10381038            $el.html(revert_e);
     
    10401040            permalink.html(permalinkOrig);
    10411041            real_slug.val(revert_slug);
    1042             $( '.edit-slug' ).focus();
     1042            $( '.edit-slug' ).trigger( 'focus' );
    10431043        });
    10441044
     
    10501050        slug_value = ( c > full.length / 4 ) ? '' : full;
    10511051
    1052         $el.html( '<input type="text" id="new-post-slug" value="' + slug_value + '" autocomplete="off" />' ).children( 'input' ).keydown( function( e ) {
     1052        $el.html( '<input type="text" id="new-post-slug" value="' + slug_value + '" autocomplete="off" />' ).children( 'input' ).on( 'keydown', function( e ) {
    10531053            var key = e.which;
    10541054            // On [Enter], just save the new slug, don't save the post.
     
    10611061                buttons.children( '.cancel' ).click();
    10621062            }
    1063         } ).keyup( function() {
     1063        } ).on( 'keyup', function() {
    10641064            real_slug.val( this.value );
    1065         }).focus();
     1065        }).trigger( 'focus' );
    10661066    }
    10671067
     
    11551155                height = parseInt( $('#content_ifr').css('height'), 10 ) + toolbarHeight - 28;
    11561156            } else {
    1157                 $textarea.focus();
     1157                $textarea.trigger( 'focus' );
    11581158                height = parseInt( $textarea.css('height'), 10 );
    11591159            }
  • trunk/src/js/_enqueues/admin/postbox.js

    r49325 r50001  
    6868
    6969            if ( id ) {
    70                 if ( !p.hasClass('closed') && $.isFunction( postboxes.pbshow ) ) {
     70                if ( !p.hasClass('closed') && typeof postboxes.pbshow === 'function' ) {
    7171                    postboxes.pbshow( id );
    72                 } else if ( p.hasClass('closed') && $.isFunction( postboxes.pbhide ) ) {
     72                } else if ( p.hasClass('closed') && typeof postboxes.pbhide === 'function' ) {
    7373                    postboxes.pbhide( id );
    7474                }
     
    268268             * @since 2.7.0
    269269             */
    270             $('.postbox .hndle a').click( function(e) {
     270            $('.postbox .hndle a').on( 'click', function(e) {
    271271                e.stopPropagation();
    272272            });
     
    303303             * @return {void}
    304304             */
    305             $('.hide-postbox-tog').bind('click.postboxes', function() {
     305            $('.hide-postbox-tog').on('click.postboxes', function() {
    306306                var $el = $(this),
    307307                    boxId = $el.val(),
     
    310310                if ( $el.prop( 'checked' ) ) {
    311311                    $postbox.show();
    312                     if ( $.isFunction( postboxes.pbshow ) ) {
     312                    if ( typeof postboxes.pbshow === 'function' ) {
    313313                        postboxes.pbshow( boxId );
    314314                    }
    315315                } else {
    316316                    $postbox.hide();
    317                     if ( $.isFunction( postboxes.pbhide ) ) {
     317                    if ( typeof postboxes.pbhide === 'function' ) {
    318318                        postboxes.pbhide( boxId );
    319319                    }
     
    337337             * @return {void}
    338338             */
    339             $('.columns-prefs input[type="radio"]').bind('click.postboxes', function(){
     339            $('.columns-prefs input[type="radio"]').on('click.postboxes', function(){
    340340                var n = parseInt($(this).val(), 10);
    341341
     
    421421
    422422            if ( isMobile ) {
    423                 $(document.body).bind('orientationchange.postboxes', function(){ postboxes._pb_change(); });
     423                $(document.body).on('orientationchange.postboxes', function(){ postboxes._pb_change(); });
    424424                this._pb_change();
    425425            }
  • trunk/src/js/_enqueues/admin/privacy-tools.js

    r49289 r50001  
    5757    }
    5858
    59     $( '.export-personal-data-handle' ).click( function( event ) {
     59    $( '.export-personal-data-handle' ).on( 'click', function( event ) {
    6060        var $this          = $( this ),
    6161            $action        = $this.parents( '.export-personal-data' ),
     
    160160    });
    161161
    162     $( '.remove-personal-data-handle' ).click( function( event ) {
     162    $( '.remove-personal-data-handle' ).on( 'click', function( event ) {
    163163        var $this         = $( this ),
    164164            $action       = $this.parents( '.remove-personal-data' ),
  • trunk/src/js/_enqueues/admin/site-health.js

    r49716 r50001  
    206206        }
    207207
    208         pct = ( ( 100 - val ) / 100 ) * c;
     208        pct = ( ( 100 - val ) / 100 ) * c + 'px';
    209209
    210210        $circle.css( { strokeDashoffset: pct } );
  • trunk/src/js/_enqueues/admin/tags.js

    r48347 r50001  
    9999     * @return {boolean} Always returns false to cancel the default event handling.
    100100     */
    101     $('#submit').click(function(){
     101    $('#submit').on( 'click', function(){
    102102        var form = $(this).parents('form');
    103103
  • trunk/src/js/_enqueues/admin/user-profile.js

    r49337 r50001  
    109109        $weakRow = $( '.pw-weak' );
    110110        $weakCheckbox = $weakRow.find( '.pw-checkbox' );
    111         $weakCheckbox.change( function() {
     111        $weakCheckbox.on( 'change', function() {
    112112            $submitButtons.prop( 'disabled', ! $weakCheckbox.prop( 'checked' ) );
    113113        } );
     
    266266        $( '#pass1' ).val( '' ).on( 'input' + ' pwupdate', check_pass_strength );
    267267        $('#pass-strength-result').show();
    268         $('.color-palette').click( function() {
     268        $('.color-palette').on( 'click', function() {
    269269            $(this).siblings('input[name="admin_color"]').prop('checked', true);
    270270        });
    271271
    272272        if ( select.length ) {
    273             $('#first_name, #last_name, #nickname').bind( 'blur.user_profile', function() {
     273            $('#first_name, #last_name, #nickname').on( 'blur.user_profile', function() {
    274274                var dub = [],
    275275                    inputs = {
  • trunk/src/js/_enqueues/admin/widgets.js

    r49151 r50001  
    3737             * button `aria-expanded` attribute value.
    3838             */
    39             .click( function() {
     39            .on( 'click', function() {
    4040                var $this = $( this ),
    4141                    $wrap = $this.closest( '.widgets-holder-wrap '),
     
    102102
    103103        // Handle the widgets containers in the left column.
    104         $( '#widgets-left .sidebar-name' ).click( function() {
     104        $( '#widgets-left .sidebar-name' ).on( 'click', function() {
    105105            var $wrap = $( this ).closest( '.widgets-holder-wrap' );
    106106
     
    113113        });
    114114
    115         $(document.body).bind('click.widgets-toggle', function(e) {
     115        $(document.body).on('click.widgets-toggle', function(e) {
    116116            var target = $(e.target), css = {},
    117117                widget, inside, targetWidth, widgetWidth, margin, saveButton, widgetId,
     
    420420        $( '#widgets-right .widgets-holder-wrap' ).each( function( index, element ) {
    421421            var $element = $( element ),
    422                 name = $element.find( '.sidebar-name h2' ).text(),
     422                name = $element.find( '.sidebar-name h2' ).text() || '',
    423423                ariaLabel = $element.find( '.sidebar-name' ).data( 'add-to' ),
    424424                id = $element.find( '.widgets-sortables' ).attr( 'id' ),
     
    429429                    'class': 'widgets-chooser-button',
    430430                    'aria-label': ariaLabel
    431                 } ).text( $.trim( name ) );
     431                } ).text( name.toString().trim() );
    432432
    433433            li.append( button );
  • trunk/src/js/_enqueues/lib/ajax-response.js

    r48040 r50001  
    6767// Basic form validation.
    6868jQuery(document).ready( function($){
    69     $('form.validate').submit( function() { return wpAjax.validateForm( $(this) ); } );
     69    $('form.validate').on( 'submit', function() { return wpAjax.validateForm( $(this) ); } );
    7070});
  • trunk/src/js/_enqueues/lib/color-picker.js

    r48383 r50001  
    233233             * @since 3.5.0
    234234             */
    235             self.toggler.click( function(){
     235            self.toggler.on( 'click', function(){
    236236                if ( self.toggler.hasClass( 'wp-picker-open' ) ) {
    237237                    self.close();
     
    251251             * @return {void}
    252252             */
    253             self.element.change( function( event ) {
     253            self.element.on( 'change', function( event ) {
    254254                var me = $( this ),
    255255                    val = me.val();
     
    273273             * @return {void}
    274274             */
    275             self.button.click( function( event ) {
     275            self.button.on( 'click', function( event ) {
    276276                var me = $( this );
    277277                if ( me.hasClass( 'wp-picker-clear' ) ) {
  • trunk/src/js/_enqueues/lib/link.js

    r47122 r50001  
    5555
    5656            // Bind event handlers.
    57             inputs.dialog.keydown( wpLink.keydown );
    58             inputs.dialog.keyup( wpLink.keyup );
    59             inputs.submit.click( function( event ) {
     57            inputs.dialog.on( 'keydown', wpLink.keydown );
     58            inputs.dialog.on( 'keyup', wpLink.keyup );
     59            inputs.submit.on( 'click', function( event ) {
    6060                event.preventDefault();
    6161                wpLink.update();
    6262            });
    6363
    64             inputs.close.add( inputs.backdrop ).add( '#wp-link-cancel button' ).click( function( event ) {
     64            inputs.close.add( inputs.backdrop ).add( '#wp-link-cancel button' ).on( 'click', function( event ) {
    6565                event.preventDefault();
    6666                wpLink.close();
     
    626626        this.refresh();
    627627
    628         $( '#wp-link .query-results, #wp-link #link-selector' ).scroll( function() {
     628        $( '#wp-link .query-results, #wp-link #link-selector' ).on( 'scroll', function() {
    629629            self.maybeLoad();
    630630        });
  • trunk/src/js/_enqueues/lib/nav-menu.js

    r48650 r50001  
    391391                break;
    392392            }
    393             $this.focus();
     393            $this.trigger( 'focus' );
    394394            api.registerChange();
    395395            api.refreshKeyboardAccessibility();
     
    573573                    }
    574574                    // Put focus back on same menu item.
    575                     $( '#edit-' + thisItemData['menu-item-db-id'] ).focus();
     575                    $( '#edit-' + thisItemData['menu-item-db-id'] ).trigger( 'focus' );
    576576                    return false;
    577577                });
     
    609609            api.menuList.hideAdvancedMenuItemFields();
    610610
    611             $('.hide-postbox-tog').click(function () {
     611            $('.hide-postbox-tog').on( 'click', function () {
    612612                var hidden = $( '.accordion-container li.accordion-section' ).filter(':hidden').map(function() { return this.id; }).get().join(',');
    613613                $.post(ajaxurl, {
     
    810810
    811811        initManageLocations : function () {
    812             $('#menu-locations-wrap form').submit(function(){
     812            $('#menu-locations-wrap form').on( 'submit', function(){
    813813                window.onbeforeunload = null;
    814814            });
     
    824824        attachMenuEditListeners : function() {
    825825            var that = this;
    826             $('#update-nav-menu').bind('click', function(e) {
     826            $('#update-nav-menu').on('click', function(e) {
    827827                if ( e.target && e.target.className ) {
    828828                    if ( -1 != e.target.className.indexOf('item-edit') ) {
     
    853853            }, 500 ) );
    854854
    855             $('#add-custom-links input[type="text"]').keypress(function(e){
     855            $('#add-custom-links input[type="text"]').on( 'keypress', function(e){
    856856                $('#customlinkdiv').removeClass('form-invalid');
    857857
     
    868868             * in a single input to avoid PHP `max_input_vars` limitations. See #14134.
    869869             */
    870             $( '#update-nav-menu' ).submit( function() {
     870            $( '#update-nav-menu' ).on( 'submit', function() {
    871871                var navMenuData = $( '#update-nav-menu' ).serializeArray();
    872872                $( '[name="nav-menu-data"]' ).val( JSON.stringify( navMenuData ) );
     
    878878            params.action = 'menu-locations-save';
    879879            params['menu-settings-column-nonce'] = $('#menu-settings-column-nonce').val();
    880             loc.find('input[type="submit"]').click(function() {
     880            loc.find('input[type="submit"]').on( 'click', function() {
    881881                loc.find('select').each(function() {
    882882                    params[this.name] = $(this).val();
     
    948948
    949949        addCustomLink : function( processMethod ) {
    950             var url = $('#custom-menu-item-url').val().trim(),
     950            var url = $('#custom-menu-item-url').val().toString(),
    951951                label = $('#custom-menu-item-name').val();
     952
     953            if ( '' !== url ) {
     954                url = url.trim();
     955            }
    952956
    953957            processMethod = processMethod || api.addMenuItemToBottom;
     
    10001004                var ins = $('#menu-instructions');
    10011005
    1002                 menuMarkup = $.trim( menuMarkup ); // Trim leading whitespaces.
     1006                menuMarkup = menuMarkup || '';
     1007                menuMarkup = menuMarkup.toString().trim(); // Trim leading whitespaces.
    10031008                processMethod(menuMarkup, params);
    10041009
     
    10441049
    10451050        attachUnsavedChangesListener : function() {
    1046             $('#menu-management input, #menu-management select, #menu-management, #menu-management textarea, .menu-location-menus select').change(function(){
     1051            $('#menu-management input, #menu-management select, #menu-management, #menu-management textarea, .menu-location-menus select').on( 'change', function(){
    10471052                api.registerChange();
    10481053            });
     
    10641069
    10651070        attachTabsPanelListeners : function() {
    1066             $('#menu-settings-column').bind('click', function(e) {
     1071            $('#menu-settings-column').on('click', function(e) {
    10671072                var selectAreaMatch, selectAll, panelId, wrapper, items,
    10681073                    target = $(e.target);
     
    10841089
    10851090                    // Select the search bar.
    1086                     $('.quick-search', wrapper).focus();
     1091                    $('.quick-search', wrapper).trigger( 'focus' );
    10871092
    10881093                    // Hide controls in the search tab if no items found.
  • trunk/src/js/_enqueues/vendor/plupload/wp-plupload.js

    r48288 r50001  
    7171        // Proxy all methods so this always refers to the current instance.
    7272        for ( key in this ) {
    73             if ( $.isFunction( this[ key ] ) ) {
     73            if ( typeof this[ key ] === 'function' ) {
    7474                this[ key ] = $.proxy( this[ key ], this );
    7575            }
     
    285285
    286286            // 'dragenter' doesn't fire correctly, simulate it with a limited 'dragover'.
    287             dropzone.bind( 'dragover.wp-uploader', function() {
     287            dropzone.on( 'dragover.wp-uploader', function() {
    288288                if ( timer ) {
    289289                    clearTimeout( timer );
     
    298298            });
    299299
    300             dropzone.bind('dragleave.wp-uploader, drop.wp-uploader', function() {
     300            dropzone.on('dragleave.wp-uploader, drop.wp-uploader', function() {
    301301                /*
    302302                 * Using an instant timer prevents the drag-over class
     
    441441                    message = Uploader.errorMap[ key ];
    442442
    443                     if ( _.isFunction( message ) ) {
     443                    if ( typeof message === 'function' ) {
    444444                        message = message( pluploadError.file, pluploadError );
    445445                    }
  • trunk/src/js/_enqueues/wp/customize/base.js

    r49353 r50001  
    502502
    503503            // If the last argument is a callback, bind it to .done().
    504             if ( $.isFunction( ids[ ids.length - 1 ] ) ) {
     504            if ( typeof ids[ ids.length - 1 ] === 'function' ) {
    505505                dfd.done( ids.pop() );
    506506            }
     
    610610
    611611            this.bind( this.update );
    612             this.element.bind( this.events, this.refresh );
     612            this.element.on( this.events, this.refresh );
    613613        },
    614614
  • trunk/src/js/_enqueues/wp/customize/controls.js

    r49785 r50001  
    13431343            }
    13441344            if ( template && container.container ) {
    1345                 return $.trim( template( _.extend(
     1345                return template( _.extend(
    13461346                    { id: container.id },
    13471347                    container.params
    1348                 ) ) );
     1348                ) ).toString().trim();
    13491349            }
    13501350
     
    15981598                            backBtn.attr( 'tabindex', '0' );
    15991599
    1600                             backBtn.focus();
     1600                            backBtn.trigger( 'focus' );
    16011601                            content.css( 'top', '' );
    16021602                            container.scrollTop( 0 );
     
    16461646                    sectionTitle.attr( 'tabindex', '0' );
    16471647
    1648                     sectionTitle.focus();
     1648                    sectionTitle.trigger( 'focus' );
    16491649                    content.css( 'top', '' );
    16501650
     
    27352735                    sectionTitle.attr( 'tabindex', '0' );
    27362736
    2737                     sectionTitle.focus();
     2737                    sectionTitle.trigger( 'focus' );
    27382738                    content.css( 'top', '' );
    27392739
     
    44864486                inputValue = String( x ) + ' ' + String( y );
    44874487                radioInput = control.container.find( 'input[name="background-position"][value="' + inputValue + '"]' );
    4488                 radioInput.click();
     4488                radioInput.trigger( 'click' );
    44894489            } );
    44904490            control.settings.x.bind( updateRadios );
     
    54535453            controlIndex = controls.indexOf( control );
    54545454            if ( controls.length === controlIndex + 1 ) {
    5455                 $( '#customize-footer-actions .collapse-sidebar' ).focus();
     5455                $( '#customize-footer-actions .collapse-sidebar' ).trigger( 'focus' );
    54565456            } else {
    54575457                controls[ controlIndex + 1 ].container.find( ':focusable:first' ).focus();
     
    63376337                } );
    63386338                previewFrame.container.append( form );
    6339                 form.submit();
     6339                form.trigger( 'submit' );
    63406340                form.remove(); // No need to keep the form around after submitted.
    63416341            }
     
    70827082        // Restore focus if there was a reflow and there was an active (focused) element.
    70837083        if ( wasReflowed && activeElement ) {
    7084             activeElement.focus();
     7084            activeElement.trigger( 'focus' );
    70857085        }
    70867086        api.trigger( 'pane-contents-reflowed' );
     
    83988398
    83998399        // Button bindings.
    8400         saveBtn.click( function( event ) {
     8400        saveBtn.on( 'click', function( event ) {
    84018401            api.previewer.save();
    84028402            event.preventDefault();
    8403         }).keydown( function( event ) {
     8403        }).on( 'keydown', function( event ) {
    84048404            if ( 9 === event.which ) { // Tab.
    84058405                return;
     
    84118411        });
    84128412
    8413         closeBtn.keydown( function( event ) {
     8413        closeBtn.on( 'keydown', function( event ) {
    84148414            if ( 9 === event.which ) { // Tab.
    84158415                return;
     
    87538753            api( 'blogname', function( setting ) {
    87548754                var updateTitle = function() {
    8755                     title.text( $.trim( setting() ) || api.l10n.untitledBlogName );
     8755                    var blogTitle = setting() || '';
     8756                    title.text( blogTitle.toString().trim() || api.l10n.untitledBlogName );
    87568757                };
    87578758                setting.bind( updateTitle );
  • trunk/src/js/_enqueues/wp/customize/nav-menus.js

    r48650 r50001  
    227227
    228228            // Load available items if it looks like we'll need them.
    229             api.panel( 'nav_menus' ).container.bind( 'expanded', function() {
     229            api.panel( 'nav_menus' ).container.on( 'expanded', function() {
    230230                if ( ! self.rendered ) {
    231231                    self.initList();
     
    235235
    236236            // Load more items.
    237             this.sectionContent.scroll( function() {
     237            this.sectionContent.on( 'scroll', function() {
    238238                var totalHeight = self.$el.find( '.accordion-section.open .available-menu-items-list' ).prop( 'scrollHeight' ),
    239239                    visibleHeight = self.$el.find( '.accordion-section.open' ).height();
     
    828828        ready: function() {
    829829            var panel = this;
    830             panel.container.find( '.hide-column-tog' ).click( function() {
     830            panel.container.find( '.hide-column-tog' ).on( 'click', function() {
    831831                panel.saveManageColumnsState();
    832832            });
     
    34223422        name = name || '';
    34233423        name = wp.sanitize.stripTagsAndEncodeText( name ); // Remove any potential tags from name.
    3424         name = $.trim( name );
     3424        name = name.toString().trim();
    34253425        return name || api.Menus.data.l10n.unnamed;
    34263426    }
  • trunk/src/js/_enqueues/wp/dashboard.js

    r49325 r50001  
    4141
    4242    // Hide the welcome panel when the dismiss button or close button is clicked.
    43     $('.welcome-panel-close, .welcome-panel-dismiss a', welcomePanel).click( function(e) {
     43    $('.welcome-panel-close, .welcome-panel-dismiss a', welcomePanel).on( 'click', function(e) {
    4444        e.preventDefault();
    4545        welcomePanel.addClass('hidden');
     
    4949
    5050    // Set welcome panel visibility based on Welcome Option checkbox value.
    51     welcomePanelHide.click( function() {
     51    welcomePanelHide.on( 'click', function() {
    5252        welcomePanel.toggleClass('hidden', ! this.checked );
    5353        updateWelcomePanel( this.checked ? 1 : 0 );
     
    137137        $( '#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]' ).prop( 'disabled' , false );
    138138
    139         t = $('#quick-press').submit( function( e ) {
     139        t = $('#quick-press').on( 'submit', function( e ) {
    140140            e.preventDefault();
    141141
     
    173173
    174174        // Change the QuickPost action to the publish value.
    175         $('#publish').click( function() { act.val( 'post-quickpress-publish' ); } );
     175        $('#publish').on( 'click', function() { act.val( 'post-quickpress-publish' ); } );
    176176
    177177        $('#quick-press').on( 'click focusin', function() {
  • trunk/src/js/_enqueues/wp/password-strength-meter.js

    r48167 r50001  
    3333         */
    3434        meter : function( password1, disallowedList, password2 ) {
    35             if ( ! $.isArray( disallowedList ) )
     35            if ( ! Array.isArray( disallowedList ) )
    3636                disallowedList = [ disallowedList.toString() ];
    3737
  • trunk/src/js/_enqueues/wp/theme-plugin-editor.js

    r49151 r50001  
    102102        component.warning
    103103            .removeClass( 'hidden' )
    104             .find( '.file-editor-warning-go-back' ).focus();
     104            .find( '.file-editor-warning-go-back' ).trigger( 'focus' );
    105105        // Get the links and buttons within the modal.
    106106        component.warningTabbables = component.warning.find( 'a, button' );
  • trunk/src/js/_enqueues/wp/theme.js

    r48688 r50001  
    7474        // Bind to the scroll event and throttle
    7575        // the results from this.scroller.
    76         this.window.bind( 'scroll', _.throttle( this.scroller, 300 ) );
     76        this.window.on( 'scroll', _.throttle( this.scroller, 300 ) );
    7777    },
    7878
     
    551551            preview.render();
    552552            this.setNavButtonsState();
    553             $( '.next-theme' ).focus();
     553            $( '.next-theme' ).trigger( 'focus' );
    554554        })
    555555        .listenTo( preview, 'theme:previous', function() {
     
    581581            preview.render();
    582582            this.setNavButtonsState();
    583             $( '.previous-theme' ).focus();
     583            $( '.previous-theme' ).trigger( 'focus' );
    584584        });
    585585
     
    603603                .prop( 'disabled', true );
    604604
    605             nextThemeButton.focus();
     605            nextThemeButton.trigger( 'focus' );
    606606        }
    607607
     
    612612                .prop( 'disabled', true );
    613613
    614             previousThemeButton.focus();
     614            previousThemeButton.trigger( 'focus' );
    615615        }
    616616    },
     
    706706        // Set initial focus on the primary action control.
    707707        _.delay( function() {
    708             $( '.theme-overlay' ).focus();
     708            $( '.theme-overlay' ).trigger( 'focus' );
    709709        }, 100 );
    710710
     
    717717            if ( 9 === event.which ) {
    718718                if ( $firstFocusable[0] === event.target && event.shiftKey ) {
    719                     $lastFocusable.focus();
     719                    $lastFocusable.trigger( 'focus' );
    720720                    event.preventDefault();
    721721                } else if ( $lastFocusable[0] === event.target && ! event.shiftKey ) {
    722                     $firstFocusable.focus();
     722                    $firstFocusable.trigger( 'focus' );
    723723                    event.preventDefault();
    724724                }
     
    765765                // Return focus to the theme div.
    766766                if ( themes.focusedTheme ) {
    767                     themes.focusedTheme.focus();
     767                    themes.focusedTheme.trigger( 'focus' );
    768768                }
    769769            });
     
    953953            // Return focus to the theme div.
    954954            if ( themes.focusedTheme ) {
    955                 themes.focusedTheme.focus();
     955                themes.focusedTheme.trigger( 'focus' );
    956956            }
    957957        }).removeClass( 'iframe-ready' );
     
    20502050        // The `search` route event. The router populates the input field.
    20512051        themes.router.on( 'route:search', function() {
    2052             $( '.wp-filter-search' ).focus().trigger( 'keyup' );
     2052            $( '.wp-filter-search' ).trigger( 'focus' ).trigger( 'keyup' );
    20532053        });
    20542054
     
    21022102        }
    21032103
    2104         if ( tbWindow.size() ) {
     2104        if ( tbWindow.length >= 1 ) {
    21052105            tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
    21062106            $('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height );
     
    21122112    };
    21132113
    2114     $(window).resize(function(){ tb_position(); });
     2114    $(window).on( 'resize', function(){ tb_position(); });
    21152115});
  • trunk/src/js/_enqueues/wp/updates.js

    r49582 r50001  
    15531553                    themes.disabled = _.without( themes.disabled, response.slug );
    15541554                    if ( themes.disabled.length ) {
    1555                         $views.find( '.disabled .count' ).text( '(' + themes.disabled.length + ')' );                       
     1555                        $views.find( '.disabled .count' ).text( '(' + themes.disabled.length + ')' );
    15561556                    } else {
    15571557                        $views.find( '.disabled' ).remove();
     
    15671567                    }
    15681568                }
    1569    
     1569
    15701570                if ( -1 !== _.indexOf( themes['auto-update-disabled'], response.slug ) ) {
    15711571                    themes['auto-update-disabled'] = _.without( themes['auto-update-disabled'], response.slug );
     
    20462046        $filesystemForm.on( 'change', 'input[name="connection_type"]', function() {
    20472047            $( '#ssh-keys' ).toggleClass( 'hidden', ( 'ssh' !== $( this ).val() ) );
    2048         } ).change();
     2048        } ).trigger( 'change' );
    20492049
    20502050        /**
     
    27662766
    27672767            try {
    2768                 message = $.parseJSON( originalEvent.data );
     2768                message = JSON.parse( originalEvent.data );
    27692769            } catch ( e ) {
    27702770                return;
  • trunk/src/js/_enqueues/wp/widgets/custom-html.js

    r48650 r50001  
    447447
    448448            // Accessibility mode.
    449             $( window ).on( 'load', function() {
     449            if ( document.readyState === 'complete' ) {
     450                // Page is fully loaded.
    450451                component.setupAccessibleMode();
    451             });
     452            } else {
     453                // Page is still loading.
     454                $( window ).on( 'load', function() {
     455                    component.setupAccessibleMode();
     456                });
     457            }
    452458        });
    453459    };
  • trunk/src/js/_enqueues/wp/widgets/media.js

    r48650 r50001  
    13211321
    13221322            // Accessibility mode.
    1323             $( window ).on( 'load', function() {
     1323            if ( document.readyState === 'complete' ) {
     1324                // Page is fully loaded.
    13241325                component.setupAccessibleMode();
    1325             });
     1326            } else {
     1327                // Page is still loading.
     1328                $( window ).on( 'load', function() {
     1329                    component.setupAccessibleMode();
     1330                });
     1331            }
    13261332        });
    13271333    };
  • trunk/src/js/media/views/focus-manager.js

    r48650 r50001  
    7070     */
    7171    focus: function() {
    72         this.$( '.media-modal' ).focus();
     72        this.$( '.media-modal' ).trigger( 'focus' );
    7373    },
    7474
  • trunk/src/js/media/views/frame/edit-attachments.js

    r47122 r50001  
    9595                $( 'body' ).off( 'keydown.media-modal' );
    9696                // Move focus back to the original item in the grid if possible.
    97                 $( 'li.attachment[data-id="' + this.model.get( 'id' ) +'"]' ).focus();
     97                $( 'li.attachment[data-id="' + this.model.get( 'id' ) +'"]' ).trigger( 'focus' );
    9898                this.resetRoute();
    9999            }, this ) );
     
    233233     */
    234234    focusNavButton: function( which ) {
    235         $( which ).focus();
     235        $( which ).trigger( 'focus' );
    236236    },
    237237
  • trunk/src/js/media/views/modal.js

    r47122 r50001  
    116116
    117117        // Set initial focus on the content instead of this view element, to avoid page scrolling.
    118         this.$( '.media-modal' ).focus();
     118        this.$( '.media-modal' ).trigger( 'focus' );
    119119
    120120        // Hide the page content from assistive technologies.
     
    137137
    138138        // Hide modal and remove restricted media modal tab focus once it's closed.
    139         this.$el.hide().undelegate( 'keydown' );
     139        this.$el.hide().off( 'keydown' );
    140140
    141141        /*
  • trunk/src/wp-admin/export.php

    r47785 r50001  
    3030            filters = form.find('.export-filters');
    3131        filters.hide();
    32         form.find('input:radio').change(function() {
     32        form.find('input:radio').on( 'change', function() {
    3333            filters.slideUp('fast');
    3434            switch ( $(this).val() ) {
  • trunk/src/wp-admin/includes/ms.php

    r49936 r50001  
    10021002jQuery(document).ready( function($) {
    10031003    var languageSelect = $( '#WPLANG' );
    1004     $( 'form' ).submit( function() {
     1004    $( 'form' ).on( 'submit', function() {
    10051005        // Don't show a spinner for English and installed languages,
    10061006        // as there is nothing to download.
  • trunk/src/wp-admin/includes/options.php

    r47808 r50001  
    1919        var parent = $( '#show_avatars' ),
    2020            children = $( '.avatar-settings' );
    21         parent.change(function(){
     21        parent.on( 'change', function(){
    2222            children.toggleClass( 'hide-if-js', ! this.checked );
    2323        });
     
    5050        });
    5151
    52         $( 'input[name="date_format"]' ).click( function() {
     52        $( 'input[name="date_format"]' ).on( 'click', function() {
    5353            if ( 'date_format_custom_radio' !== $(this).attr( 'id' ) )
    5454                $( 'input[name="date_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() );
     
    5959        });
    6060
    61         $( 'input[name="time_format"]' ).click( function() {
     61        $( 'input[name="time_format"]' ).on( 'click', function() {
    6262            if ( 'time_format_custom_radio' !== $(this).attr( 'id' ) )
    6363                $( 'input[name="time_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() );
     
    9090
    9191        var languageSelect = $( '#WPLANG' );
    92         $( 'form' ).submit( function() {
     92        $( 'form' ).on( 'submit', function() {
    9393            // Don't show a spinner for English and installed languages,
    9494            // as there is nothing to download.
     
    118118            };
    119119        check_disabled();
    120         section.find( 'input:radio' ).change( check_disabled );
     120        section.find( 'input:radio' ).on( 'change', check_disabled );
    121121    });
    122122</script>
  • trunk/src/wp-content/themes/twentyeleven/js/showcase.js

    r17761 r50001  
    11(function($) {
    22    $(document).ready( function() {
    3         $('.feature-slider a').click(function(e) {
     3        $('.feature-slider a').on( 'click', function(e) {
    44            $('.featured-posts section.featured-post').css({
    55                opacity: 0,
  • trunk/src/wp-content/themes/twentyfifteen/js/functions.js

    r47122 r50001  
    1818        container.find( '.current-menu-ancestor > .sub-menu' ).addClass( 'toggled-on' );
    1919
    20         container.find( '.dropdown-toggle' ).click( function( e ) {
     20        container.find( '.dropdown-toggle' ).on( 'click', function( e ) {
    2121            var _this = $( this );
    2222            e.preventDefault();
  • trunk/src/wp-content/themes/twentyfourteen/js/functions.js

    r47122 r50001  
    148148    } );
    149149
    150     _window.load( function() {
     150    _window.on( 'load', function() {
    151151        var footerSidebar,
    152152            isCustomizeSelectiveRefresh = ( 'undefined' !== typeof wp && wp.customize && wp.customize.selectiveRefresh );
    153153
    154154        // Arrange footer widgets vertically.
    155         if ( $.isFunction( $.fn.masonry ) ) {
     155        if ( typeof $.fn.masonry === 'function' ) {
    156156            footerSidebar = $( '#footer-sidebar' );
    157157            footerSidebar.masonry( {
  • trunk/src/wp-content/themes/twentyseventeen/assets/js/global.js

    r46586 r50001  
    2727
    2828    // Ensure the sticky navigation doesn't cover current focused links.
    29     $( 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex], [contenteditable]', '.site-content-contain' ).filter( ':visible' ).focus( function() {
     29    $( 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex], [contenteditable]', '.site-content-contain' ).filter( ':visible' ).on( 'focus', function() {
    3030        if ( $navigation.hasClass( 'site-navigation-fixed' ) ) {
    3131            var windowScrollTop = $( window ).scrollTop(),
     
    198198            }
    199199
    200             $menuScrollDown.click( function( e ) {
     200            $menuScrollDown.on( 'click', function( e ) {
    201201                e.preventDefault();
    202202                $( window ).scrollTo( '#primary', {
     
    229229
    230230        // Also want to make sure the navigation is where it should be on resize.
    231         $( window ).resize( function() {
     231        $( window ).on( 'resize', function() {
    232232            setNavProps();
    233233            setTimeout( adjustScrollClass, 500 );
     
    235235    }
    236236
    237     $( window ).resize( function() {
     237    $( window ).on( 'resize', function() {
    238238        clearTimeout( resizeTimer );
    239239        resizeTimer = setTimeout( function() {
  • trunk/src/wp-content/themes/twentyseventeen/assets/js/navigation.js

    r46586 r50001  
    2727        container.find( '.current-menu-ancestor > .sub-menu' ).addClass( 'toggled-on' );
    2828
    29         container.find( '.dropdown-toggle' ).click( function( e ) {
     29        container.find( '.dropdown-toggle' ).on( 'click', function( e ) {
    3030            var _this = $( this ),
    3131                screenReaderSpan = _this.find( '.screen-reader-text' );
  • trunk/src/wp-content/themes/twentysixteen/js/functions.js

    r44263 r50001  
    2929        container.find( '.menu-item-has-children' ).attr( 'aria-haspopup', 'true' );
    3030
    31         container.find( '.dropdown-toggle' ).click( function( e ) {
     31        container.find( '.dropdown-toggle' ).on( 'click', function( e ) {
    3232            var _this            = $( this ),
    3333                screenReaderSpan = _this.find( '.screen-reader-text' );
  • trunk/src/wp-content/themes/twentythirteen/js/functions.js

    r42411 r50001  
    124124    $( function() {
    125125        var columnWidth, widgetArea;
    126         if ( ! $.isFunction( $.fn.masonry ) ) {
     126        if ( typeof $.fn.masonry !== 'function' ) {
    127127            return;
    128128        }
Note: See TracChangeset for help on using the changeset viewer.