Make WordPress Core

Ticket #59689: 59689.4.diff

File 59689.4.diff, 2.0 KB (added by bplv, 2 years ago)
  • src/js/_enqueues/admin/common.js

    diff --git a/src/js/_enqueues/admin/common.js b/src/js/_enqueues/admin/common.js
    index e3daa8c4d1..2d9fc8c09b 100644
    a b $( function() { 
    17331733                                                setTimeout( function() {
    17341734                                                        var focusIsInToggle  = $.contains( toggleButton, focusedElement );
    17351735                                                        var focusIsInSidebar = $.contains( sidebar, focusedElement );
    1736                                                        
     1736
    17371737                                                        if ( ! focusIsInToggle && ! focusIsInSidebar ) {
    17381738                                                                $( toggleButton ).trigger( 'click.wp-responsive' );
    17391739                                                        }
    $( function( $ ) { 
    21292129/**
    21302130 * Freeze animated plugin icons when reduced motion is enabled.
    21312131 *
    2132  * When the user has enabled the 'prefers-reduced-motion' setting, this module 
    2133  * stops animations for all GIFs on the page with the class 'plugin-icon' or 
     2132 * When the user has enabled the 'prefers-reduced-motion' setting, this module
     2133 * stops animations for all GIFs on the page with the class 'plugin-icon' or
    21342134 * plugin icon images in the update plugins table.
    21352135 *
    21362136 * @since 6.4.0
    $( function( $ ) { 
    21562156                        var width = img.width;
    21572157                        var height = img.height;
    21582158                        var canvas = document.createElement( 'canvas' );
    2159                        
     2159
    21602160                        // Set canvas dimensions.
    21612161                        canvas.width = width;
    21622162                        canvas.height = height;
    $( function( $ ) { 
    22202220        // Listen for jQuery AJAX events.
    22212221        ( function( $ ) {
    22222222                $( document ).ajaxComplete( function( event, xhr, settings ) {
     2223
     2224                        // Return early if this is not the plugin-install.php page.
     2225                        if ( window.pagenow !== 'plugin-install' ) {
     2226                                return;
     2227                        }
     2228
    22232229                        // Check if this is the 'search-install-plugins' request.
    2224                         if ( settings.data && settings.data.includes( 'action=search-install-plugins' ) ) {
     2230                        if ( settings.data && typeof settings.data === "string" && settings.data.includes( 'action=search-install-plugins' ) ) {
    22252231                                // Recheck if the user prefers reduced motion.
    22262232                                if ( window.matchMedia ) {
    22272233                                        var mediaQuery = window.matchMedia( '(prefers-reduced-motion: reduce)' );