Skip to content

Commit f525e66

Browse files
committed
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 [https://make.wordpress.org/core/handbook/best-practices/browser-support/ 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. git-svn-id: https://develop.svn.wordpress.org/trunk@57981 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 5afdac7 commit f525e66

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/wp-includes/script-loader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ function wp_default_packages_vendor( $scripts ) {
8989
$suffix = wp_scripts_get_suffix();
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',
9696
'lodash',
@@ -103,7 +103,7 @@ function wp_default_packages_vendor( $scripts ) {
103103
'wp-polyfill-element-closest',
104104
'wp-polyfill-object-fit',
105105
'wp-polyfill-inert',
106-
'wp-polyfill' => array( 'wp-polyfill-inert', 'regenerator-runtime' ),
106+
'wp-polyfill',
107107
);
108108

109109
$vendor_scripts_versions = array(

tests/phpunit/tests/dependencies/scripts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2072,7 +2072,7 @@ public function test_wp_add_inline_script_before_after_concat_with_core_dependen
20722072
$wp_scripts->base_url = '';
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";
20782078
$expected .= "<script type='text/javascript' src='/wp-includes/js/dist/i18n.min.js' id='wp-i18n-js'></script>\n";

0 commit comments

Comments
 (0)