From 5c414db9adb41cca7ba517411b660f5252b38b1d Mon Sep 17 00:00:00 2001 From: hellofromTonya Date: Tue, 30 Nov 2021 17:18:01 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@52285 git-svn-id: http://core.svn.wordpress.org/trunk@51877 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-header.php | 2 +- wp-admin/export.php | 4 ++-- wp-admin/includes/class-custom-image-header.php | 8 ++++---- wp-admin/includes/class-wp-internal-pointers.php | 4 +++- wp-admin/includes/deprecated.php | 4 ++-- wp-admin/includes/media.php | 6 +++--- wp-admin/includes/meta-boxes.php | 2 +- wp-admin/includes/ms.php | 4 ++-- wp-admin/includes/options.php | 8 ++++---- wp-admin/includes/template.php | 2 +- wp-admin/includes/user.php | 4 ++-- wp-admin/js/common.js | 2 +- wp-content/themes/twentyeleven/inc/theme-options.js | 6 +++--- wp-content/themes/twentyeleven/js/showcase.js | 4 ++-- wp-content/themes/twentyfifteen/js/functions.js | 2 +- .../themes/twentyfourteen/js/featured-content-admin.js | 4 ++-- wp-content/themes/twentyseventeen/assets/js/global.js | 4 ++-- wp-content/themes/twentysixteen/js/functions.js | 2 +- .../themes/twentytwenty/assets/js/customize-preview.js | 2 +- wp-content/themes/twentytwenty/assets/js/customize.js | 2 +- wp-includes/class-wp-embed.php | 4 ++-- wp-includes/script-loader.php | 2 +- wp-includes/version.php | 2 +- 23 files changed, 43 insertions(+), 41 deletions(-) diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 9106c63a03..57e036496f 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -97,7 +97,7 @@ wp_enqueue_script( 'svg-painter' ); $admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix ); ?> toggle_text(); - }); + } ); })(jQuery); ; var yinit = ; var ratio = xinit / yinit; @@ -485,7 +485,7 @@ class Custom_Image_Header { jQuery('#height').val(c.height); } }); - }); + } ); diff --git a/wp-admin/includes/deprecated.php b/wp-admin/includes/deprecated.php index e8ae4e945b..fff0f78071 100644 --- a/wp-admin/includes/deprecated.php +++ b/wp-admin/includes/deprecated.php @@ -1507,7 +1507,7 @@ function post_form_autocomplete_off() { function options_permalink_add_js() { ?> @@ -2501,11 +2501,11 @@ function media_upload_type_url_form( $type = null, $errors = null, $id = null ) } }; - jQuery(document).ready( function($) { + jQuery( function($) { $('.media-types input').click( function() { $('table.describe').toggleClass('not-image', $('#not-image').prop('checked') ); }); - }); + } );
diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 3205f28854..00cede846e 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -865,7 +865,7 @@ function post_comment_meta_box( $post ) { $hidden = get_hidden_meta_boxes( get_current_screen() ); if ( ! in_array( 'commentsdiv', $hidden, true ) ) { ?> - + '); farbtastic = $.farbtastic('#colorPickerDiv', pickColor); @@ -48,5 +48,5 @@ var farbtastic; currentDefault.text( newDefault ); }); - }); -})(jQuery); \ No newline at end of file + } ); +})(jQuery); diff --git a/wp-content/themes/twentyeleven/js/showcase.js b/wp-content/themes/twentyeleven/js/showcase.js index e1902e6b9c..91973f4854 100644 --- a/wp-content/themes/twentyeleven/js/showcase.js +++ b/wp-content/themes/twentyeleven/js/showcase.js @@ -1,5 +1,5 @@ (function($) { - $(document).ready( function() { + $( function() { $('.feature-slider a').on( 'click', function(e) { $('.featured-posts section.featured-post').css({ opacity: 0, @@ -13,5 +13,5 @@ $(this).addClass('active'); e.preventDefault(); }); - }); + } ); })(jQuery); diff --git a/wp-content/themes/twentyfifteen/js/functions.js b/wp-content/themes/twentyfifteen/js/functions.js index eaa3cac3b4..1124de0d4d 100644 --- a/wp-content/themes/twentyfifteen/js/functions.js +++ b/wp-content/themes/twentyfifteen/js/functions.js @@ -111,7 +111,7 @@ } } - $( document ).ready( function() { + $( function() { $body = $( document.body ); $window = $( window ); $sidebar = $( '#sidebar' ).first(); diff --git a/wp-content/themes/twentyfourteen/js/featured-content-admin.js b/wp-content/themes/twentyfourteen/js/featured-content-admin.js index 66f4c0718d..3bbe2cc6fd 100644 --- a/wp-content/themes/twentyfourteen/js/featured-content-admin.js +++ b/wp-content/themes/twentyfourteen/js/featured-content-admin.js @@ -4,6 +4,6 @@ */ /* global ajaxurl:true */ -jQuery( document ).ready( function( $ ) { +jQuery( function($) { $( '#customize-control-featured-content-tag-name input' ).suggest( ajaxurl + '?action=ajax-tag-search&tax=post_tag', { delay: 500, minchars: 2 } ); -}); +} ); diff --git a/wp-content/themes/twentyseventeen/assets/js/global.js b/wp-content/themes/twentyseventeen/assets/js/global.js index 966889233c..cb9bc36624 100644 --- a/wp-content/themes/twentyseventeen/assets/js/global.js +++ b/wp-content/themes/twentyseventeen/assets/js/global.js @@ -178,7 +178,7 @@ } // Fire on document ready. - $( document ).ready( function() { + $( function() { // If navigation menu is present on page, setNavProps and adjustScrollClass. if ( $navigation.length ) { @@ -218,7 +218,7 @@ if ( true === supportsFixedBackground() ) { document.documentElement.className += ' background-fixed'; } - }); + } ); // If navigation menu is present on page, adjust it on scroll and screen resize. if ( $navigation.length ) { diff --git a/wp-content/themes/twentysixteen/js/functions.js b/wp-content/themes/twentysixteen/js/functions.js index d7aed1bde9..4c3b97d032 100644 --- a/wp-content/themes/twentysixteen/js/functions.js +++ b/wp-content/themes/twentysixteen/js/functions.js @@ -191,7 +191,7 @@ } ); } - $( document ).ready( function() { + $( function() { body = $( document.body ); $( window ) diff --git a/wp-content/themes/twentytwenty/assets/js/customize-preview.js b/wp-content/themes/twentytwenty/assets/js/customize-preview.js index fb76429ffe..36608f724a 100644 --- a/wp-content/themes/twentytwenty/assets/js/customize-preview.js +++ b/wp-content/themes/twentytwenty/assets/js/customize-preview.js @@ -186,7 +186,7 @@ stylesheet.html( styles ); } // Generate styles on load. Handles page-changes on the preview pane. - $( document ).ready( function() { + $( function() { twentyTwentyGenerateColorA11yPreviewStyles( 'content' ); twentyTwentyGenerateColorA11yPreviewStyles( 'header-footer' ); } ); diff --git a/wp-content/themes/twentytwenty/assets/js/customize.js b/wp-content/themes/twentytwenty/assets/js/customize.js index 2a38ace1d8..944aae95bf 100644 --- a/wp-content/themes/twentytwenty/assets/js/customize.js +++ b/wp-content/themes/twentytwenty/assets/js/customize.js @@ -1,7 +1,7 @@ /* global wp, jQuery */ ( function( $, api ) { - $( document ).ready( function() { + $( function() { // Make it possible to reset the color based on a radio input's value. // `active` can be either `custom` or `default`. api.control( 'accent_hue_active' ).setting.bind( function( active ) { diff --git a/wp-includes/class-wp-embed.php b/wp-includes/class-wp-embed.php index 1fa37be41b..d93ea7c01e 100644 --- a/wp-includes/class-wp-embed.php +++ b/wp-includes/class-wp-embed.php @@ -88,9 +88,9 @@ class WP_Embed { } ?>