Make WordPress Core

Changeset 52285


Ignore:
Timestamp:
11/30/2021 05:16:13 PM (5 years ago)
Author:
hellofromTonya
Message:

External Libraries: Further fix jQuery deprecations in WordPress core.

Follow-up to [50001], [50270], [50367], [50383], [50410], [50420], [50429], [50547].

Props chaion07, Clorith, costdev, desrosj, malthert, peterwilsoncc, presskopp, promz, sabernhardt, SergeyBiryukov, toro_unit, wpnomad.
Fixes #51519.

Location:
trunk/src
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/common.js

    r51977 r52285  
    17281728                        $document.on( 'wp-window-resized.wp-responsive', this.trigger.bind( this ) );
    17291729
    1730                         // This needs to run later as UI Sortable may be initialized later on $(document).ready().
     1730                        // This needs to run later as UI Sortable may be initialized when the document is ready.
    17311731                        $window.on( 'load.wp-responsive', this.maybeDisableSortables );
    17321732                        $document.on( 'postbox-toggled', this.maybeDisableSortables );
  • trunk/src/wp-admin/admin-header.php

    r52030 r52285  
    9898?>
    9999<script type="text/javascript">
    100 addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(document).ready(func);else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
     100addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(function(){func();});else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
    101101var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>',
    102102        pagenow = '<?php echo esc_js( $current_screen->id ); ?>',
  • trunk/src/wp-admin/export.php

    r51475 r52285  
    2828        ?>
    2929<script type="text/javascript">
    30         jQuery(document).ready(function($){
     30        jQuery( function($) {
    3131                var form = $('#export-filters'),
    3232                        filters = form.find('.export-filters');
    … …  
    4040                        }
    4141                });
    42         });
     42        } );
    4343</script>
    4444        <?php
  • trunk/src/wp-admin/includes/class-custom-image-header.php

    r50707 r52285  
    394394        }
    395395
    396         $(document).ready(function() {
     396        $( function() {
    397397                var text_color = $('#text-color');
    398398                header_text_fields = $('.displaying-header-text');
    … …  
    409409                toggle_text();
    410410                <?php endif; ?>
    411         });
     411        } );
    412412})(jQuery);
    413413</script>
    … …  
    431431        }
    432432
    433         jQuery(document).ready(function() {
     433        jQuery( function() {
    434434                var xinit = <?php echo absint( get_theme_support( 'custom-header', 'width' ) ); ?>;
    435435                var yinit = <?php echo absint( get_theme_support( 'custom-header', 'height' ) ); ?>;
    … …  
    486486                        }
    487487                });
    488         });
     488        } );
    489489</script>
    490490                <?php
  • trunk/src/wp-admin/includes/class-wp-internal-pointers.php

    r47122 r52285  
    141141                                $(window).bind( 'load.wp-pointers', setup );
    142142                        else
    143                                 $(document).ready( setup );
     143                                $( function() {
     144                                        setup();
     145                                } );
    144146
    145147                })( jQuery );
  • trunk/src/wp-admin/includes/deprecated.php

    r52035 r52285  
    15081508        ?>
    15091509        <script type="text/javascript">
    1510                 jQuery(document).ready(function() {
     1510                jQuery( function() {
    15111511                        jQuery('.permalink-structure input:radio').change(function() {
    15121512                                if ( 'custom' == this.value )
    … …  
    15171517                                jQuery( '#custom_selection' ).prop( 'checked', true );
    15181518                        });
    1519                 });
     1519                } );
    15201520        </script>
    15211521        <?php
  • trunk/src/wp-admin/includes/media.php

    r52254 r52285  
    534534        ?>
    535535        <script type="text/javascript">
    536         addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(document).ready(func);else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
     536        addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(function(){func();});else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
    537537        var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',
    538538        isRtl = <?php echo (int) is_rtl(); ?>;
    … …  
    25022502        };
    25032503
    2504         jQuery(document).ready( function($) {
     2504        jQuery( function($) {
    25052505                $('.media-types input').click( function() {
    25062506                        $('table.describe').toggleClass('not-image', $('#not-image').prop('checked') );
    25072507                });
    2508         });
     2508        } );
    25092509        </script>
    25102510
  • trunk/src/wp-admin/includes/meta-boxes.php

    r52204 r52285  
    866866                if ( ! in_array( 'commentsdiv', $hidden, true ) ) {
    867867                        ?>
    868                         <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
     868                        <script type="text/javascript">jQuery(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
    869869                        <?php
    870870                }
  • trunk/src/wp-admin/includes/ms.php

    r52086 r52285  
    10111011        ?>
    10121012<script type="text/javascript">
    1013 jQuery(document).ready( function($) {
     1013jQuery( function($) {
    10141014        var languageSelect = $( '#WPLANG' );
    10151015        $( 'form' ).on( 'submit', function() {
    … …  
    10201020                }
    10211021        });
    1022 });
     1022} );
    10231023</script>
    10241024        <?php
  • trunk/src/wp-admin/includes/options.php

    r50001 r52285  
    3535        ?>
    3636<script type="text/javascript">
    37         jQuery(document).ready(function($){
     37        jQuery( function($) {
    3838                var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first(),
    3939                        homeURL = ( <?php echo wp_json_encode( get_home_url() ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' );
    … …  
    9797                        }
    9898                });
    99         });
     99        } );
    100100</script>
    101101        <?php
    … …  
    110110        ?>
    111111<script type="text/javascript">
    112         jQuery(document).ready(function($){
     112        jQuery( function($) {
    113113                var section = $('#front-static-pages'),
    114114                        staticPage = section.find('input:radio[value="page"]'),
    … …  
    119119                check_disabled();
    120120                section.find( 'input:radio' ).on( 'change', check_disabled );
    121         });
     121        } );
    122122</script>
    123123        <?php
  • trunk/src/wp-admin/includes/template.php

    r52204 r52285  
    20322032        ?>
    20332033<script type="text/javascript">
    2034 addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(document).ready(func);else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
     2034addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(function(){func();});else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
    20352035function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();}
    20362036var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>',
  • trunk/src/wp-admin/includes/user.php

    r52204 r52285  
    537537        ?>
    538538<script>
    539 jQuery(document).ready( function($) {
     539jQuery( function($) {
    540540        var submit = $('#submit').prop('disabled', true);
    541541        $('input[name="delete_option"]').one('change', function() {
    … …  
    545545                $('#delete_option1').prop('checked', true).trigger('change');
    546546        });
    547 });
     547} );
    548548</script>
    549549        <?php
  • trunk/src/wp-content/themes/twentyeleven/inc/theme-options.js

    r18229 r52285  
    88        };
    99
    10         $(document).ready( function() {
     10        $( function() {
    1111                $('#default-color').wrapInner('<a href="#" />');
    1212
    … …  
    4949                        currentDefault.text( newDefault );
    5050                });
    51         });
     51        } );
    5252})(jQuery);
  • trunk/src/wp-content/themes/twentyeleven/js/showcase.js

    r50001 r52285  
    11(function($) {
    2         $(document).ready( function() {
     2        $( function() {
    33            $('.feature-slider a').on( 'click', function(e) {
    44                $('.featured-posts section.featured-post').css({
    … …  
    1414                e.preventDefault();
    1515            });
    16         });
     16        } );
    1717})(jQuery);
  • trunk/src/wp-content/themes/twentyfifteen/js/functions.js

    r50001 r52285  
    112112        }
    113113
    114         $( document ).ready( function() {
     114        $( function() {
    115115                $body          = $( document.body );
    116116                $window        = $( window );
  • trunk/src/wp-content/themes/twentyfourteen/js/featured-content-admin.js

    r26707 r52285  
    55/* global ajaxurl:true */
    66
    7 jQuery( document ).ready( function( $ ) {
     7jQuery( function($) {
    88        $( '#customize-control-featured-content-tag-name input' ).suggest( ajaxurl + '?action=ajax-tag-search&tax=post_tag', { delay: 500, minchars: 2 } );
    9 });
     9} );
  • trunk/src/wp-content/themes/twentyseventeen/assets/js/global.js

    r51257 r52285  
    179179
    180180        // Fire on document ready.
    181         $( document ).ready( function() {
     181        $( function() {
    182182
    183183                // If navigation menu is present on page, setNavProps and adjustScrollClass.
    … …  
    219219                        document.documentElement.className += ' background-fixed';
    220220                }
    221         });
     221        } );
    222222
    223223        // If navigation menu is present on page, adjust it on scroll and screen resize.
  • trunk/src/wp-content/themes/twentysixteen/js/functions.js

    r50001 r52285  
    192192        }
    193193
    194         $( document ).ready( function() {
     194        $( function() {
    195195                body = $( document.body );
    196196
  • trunk/src/wp-content/themes/twentytwenty/assets/js/customize-preview.js

    r51322 r52285  
    187187        }
    188188        // Generate styles on load. Handles page-changes on the preview pane.
    189         $( document ).ready( function() {
     189        $( function() {
    190190                twentyTwentyGenerateColorA11yPreviewStyles( 'content' );
    191191                twentyTwentyGenerateColorA11yPreviewStyles( 'header-footer' );
  • trunk/src/wp-content/themes/twentytwenty/assets/js/customize.js

    r46585 r52285  
    22
    33( function( $, api ) {
    4         $( document ).ready( function() {
     4        $( function() {
    55                // Make it possible to reset the color based on a radio input's value.
    66                // `active` can be either `custom` or `default`.
  • trunk/src/wp-includes/class-wp-embed.php

    r51177 r52285  
    8989                ?>
    9090<script type="text/javascript">
    91         jQuery(document).ready(function($){
     91        jQuery( function($) {
    9292                $.get("<?php echo esc_url( admin_url( 'admin-ajax.php', 'relative' ) ) . '?action=oembed-cache&post=' . $post->ID; ?>");
    93         });
     93        } );
    9494</script>
    9595                <?php
  • trunk/src/wp-includes/script-loader.php

    r52262 r52285  
    18171817        );
    18181818
    1819         wp_add_inline_script( 'jquery-ui-datepicker', "jQuery(document).ready(function(jQuery){jQuery.datepicker.setDefaults({$datepicker_defaults});});" );
     1819        wp_add_inline_script( 'jquery-ui-datepicker', "jQuery(function(jQuery){jQuery.datepicker.setDefaults({$datepicker_defaults});});" );
    18201820}
    18211821
Note: See TracChangeset for help on using the changeset viewer.