Make WordPress Core

Changeset 57981


Ignore:
Timestamp:
04/10/2024 02:40:05 PM (6 weeks ago)
Author:
swissspidy
Message:

Script Loader: stop enqueueing some now obsolete polyfills.

Stop enqueueing polyfills such as wp-polyfill-inert (for the inert attribute) and regenerator-runtime (for generator functions), as they are no longer needed, considering the WordPress project's browser support policy.

In addition to that, wp-polyfill (essentially core-js) is no longer enqueued as a dependency of react. This was added in [43903] to ensure compatibility with IE 11, which is no longer supported by WordPress. Developers requiring wp-polyfill need to manually add it as a dependency for their scripts.

Props swissspidy, flixos90, adamsilverstein, youknowriad, gziolo.
Fixes #60962.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r57713 r57981  
    9090
    9191    $vendor_scripts = array(
    92         'react'       => array( 'wp-polyfill' ),
    93         'react-dom'   => array( 'react' ),
     92        'react',
     93        'react-dom' => array( 'react' ),
    9494        'regenerator-runtime',
    9595        'moment',
     
    104104        'wp-polyfill-object-fit',
    105105        'wp-polyfill-inert',
    106         'wp-polyfill' => array( 'wp-polyfill-inert', 'regenerator-runtime' ),
     106        'wp-polyfill',
    107107    );
    108108
  • trunk/tests/phpunit/tests/dependencies/scripts.php

    r57492 r57981  
    20732073        $wp_scripts->do_concat = true;
    20742074
    2075         $expected  = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5Bchunk_0%5D=jquery-core,jquery-migrate,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-dom-ready,wp-hooks&amp;ver={$wp_version}'></script>\n";
     2075        $expected  = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5Bchunk_0%5D=jquery-core,jquery-migrate,wp-polyfill,wp-dom-ready,wp-hooks&amp;ver={$wp_version}'></script>\n";
    20762076        $expected .= "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
    20772077        $expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
Note: See TracChangeset for help on using the changeset viewer.