diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 17af8d521ccab..a60ad869ef700 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -534,7 +534,6 @@ importers: '@wordpress/server-side-render': 3.0.2 '@wordpress/url': 3.2.2 '@wordpress/viewport': 4.0.2 - abortcontroller-polyfill: 1.7.1 bounding-client-rect: 1.0.5 chai: 4.3.4 chalk: 4.1.1 @@ -628,7 +627,6 @@ importers: uuid: 8.3.2 webpack: 5.51.1 webpack-cli: 4.8.0 - whatwg-fetch: 3.6.2 dependencies: '@automattic/calypso-build': 9.0.0_1fe407fcee7f7b1b50bfdbf31ccbc0fe '@automattic/calypso-color-schemes': 2.1.1 @@ -657,7 +655,6 @@ importers: '@wordpress/interface': 4.1.0_2ccf75bd525644be36fe60c4756fa1e9 '@wordpress/url': 3.2.2 '@wordpress/viewport': 4.0.2_react@17.0.2+redux@4.0.5 - abortcontroller-polyfill: 1.7.1 bounding-client-rect: 1.0.5 classnames: 2.3.1 click-outside: 2.0.2 @@ -721,7 +718,6 @@ importers: uuid: 8.3.2 webpack: 5.51.1_webpack-cli@4.8.0 webpack-cli: 4.8.0_webpack@5.51.1 - whatwg-fetch: 3.6.2 optionalDependencies: react: 17.0.2 react-dom: 17.0.2_react@17.0.2 @@ -7334,10 +7330,6 @@ packages: /abab/2.0.5: resolution: {integrity: sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q==} - /abortcontroller-polyfill/1.7.1: - resolution: {integrity: sha512-yml9NiDEH4M4p0G4AcPkg8AAa4mF3nfYF28VQxaokpO67j9H7gWgmsVWJ/f1Rn+PzsnDYvzJzWIQzCqDKRvWlA==} - dev: false - /accepts/1.3.7: resolution: {integrity: sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==} engines: {node: '>= 0.6'} diff --git a/projects/plugins/jetpack/changelog/remove-instant-search-ie11-polyfill b/projects/plugins/jetpack/changelog/remove-instant-search-ie11-polyfill new file mode 100644 index 0000000000000..af938e818a35f --- /dev/null +++ b/projects/plugins/jetpack/changelog/remove-instant-search-ie11-polyfill @@ -0,0 +1,4 @@ +Significance: patch +Type: compat + +Instant Search: As IE11 support was removed in Jetpack 10.1, remove an IE11 polyfill. diff --git a/projects/plugins/jetpack/modules/search/class-jetpack-instant-search.php b/projects/plugins/jetpack/modules/search/class-jetpack-instant-search.php index 0a0ccaeb7d08a..d0400a3fbbd91 100644 --- a/projects/plugins/jetpack/modules/search/class-jetpack-instant-search.php +++ b/projects/plugins/jetpack/modules/search/class-jetpack-instant-search.php @@ -115,25 +115,12 @@ public function load_assets() { * @param string $plugin_base_path - Base path for use in plugins_url. */ public function load_assets_with_parameters( $path_prefix, $plugin_base_path ) { - $polyfill_relative_path = $path_prefix . '_inc/build/instant-search/jp-search-ie11-polyfill-loader.bundle.js'; - $script_relative_path = $path_prefix . '_inc/build/instant-search/jp-search-main.bundle.js'; + $script_relative_path = $path_prefix . '_inc/build/instant-search/jp-search-main.bundle.js'; - if ( - ! file_exists( JETPACK__PLUGIN_DIR . $polyfill_relative_path ) || - ! file_exists( JETPACK__PLUGIN_DIR . $script_relative_path ) - ) { + if ( ! file_exists( JETPACK__PLUGIN_DIR . $script_relative_path ) ) { return; } - $polyfill_version = Jetpack_Search_Helpers::get_asset_version( $polyfill_relative_path ); - $polyfill_path = plugins_url( $polyfill_relative_path, $plugin_base_path ); - wp_enqueue_script( 'jetpack-instant-search-ie11', $polyfill_path, array(), $polyfill_version, true ); - $polyfill_payload_path = plugins_url( - $path_prefix . '_inc/build/instant-search/jp-search-ie11-polyfill-payload.bundle.js', - $plugin_base_path - ); - $this->inject_polyfill_js_options( $polyfill_payload_path ); - $script_version = Jetpack_Search_Helpers::get_asset_version( $script_relative_path ); $script_path = plugins_url( $script_relative_path, $plugin_base_path ); wp_enqueue_script( 'jetpack-instant-search', $script_path, array(), $script_version, true ); @@ -151,15 +138,6 @@ protected function inject_javascript_options() { wp_add_inline_script( 'jetpack-instant-search', 'var JetpackInstantSearchOptions=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( $options ) ) . '"));', 'before' ); } - /** - * Passes options to the polyfill loader script. - * - * @param string $polyfill_payload_path - Absolute path to the IE11 polyfill payload. - */ - protected function inject_polyfill_js_options( $polyfill_payload_path ) { - wp_add_inline_script( 'jetpack-instant-search-ie11', 'var JetpackInstantSearchIe11PolyfillPath=decodeURIComponent("' . rawurlencode( $polyfill_payload_path ) . '");', 'before' ); - } - /** * Registers a widget sidebar for Instant Search. */ diff --git a/projects/plugins/jetpack/modules/search/instant-search/ie11-polyfill.js b/projects/plugins/jetpack/modules/search/instant-search/ie11-polyfill.js deleted file mode 100644 index 86cdd96489336..0000000000000 --- a/projects/plugins/jetpack/modules/search/instant-search/ie11-polyfill.js +++ /dev/null @@ -1,10 +0,0 @@ -// self-invoked wrapper for scoping the `document` variable -! ( function ( d ) { - // currentScript is supported by all modern browsers, but not by IE. - // https://caniuse.com/document-currentscript - if ( ! d.currentScript ) { - const s = d.createElement( 'script' ); - s.src = window.JetpackInstantSearchIe11PolyfillPath; - d.head.appendChild( s ); - } -} )( document ); diff --git a/projects/plugins/jetpack/package.json b/projects/plugins/jetpack/package.json index 309c1a88b7826..ef1f15b18f247 100644 --- a/projects/plugins/jetpack/package.json +++ b/projects/plugins/jetpack/package.json @@ -86,7 +86,6 @@ "@wordpress/interface": "4.1.0", "@wordpress/url": "3.2.2", "@wordpress/viewport": "4.0.2", - "abortcontroller-polyfill": "1.7.1", "bounding-client-rect": "1.0.5", "classnames": "2.3.1", "click-outside": "2.0.2", @@ -149,8 +148,7 @@ "url-polyfill": "1.1.12", "uuid": "8.3.2", "webpack": "5.51.1", - "webpack-cli": "4.8.0", - "whatwg-fetch": "3.6.2" + "webpack-cli": "4.8.0" }, "devDependencies": { "@automattic/color-studio": "2.5.0", diff --git a/projects/plugins/jetpack/tools/webpack.config.search.js b/projects/plugins/jetpack/tools/webpack.config.search.js index a55ee780d25bf..93ba9456e240d 100644 --- a/projects/plugins/jetpack/tools/webpack.config.search.js +++ b/projects/plugins/jetpack/tools/webpack.config.search.js @@ -22,16 +22,6 @@ const baseWebpackConfig = getBaseWebpackConfig( { entry: { main: path.join( __dirname, '../modules/search/instant-search/loader.js' ), - 'ie11-polyfill-loader': path.join( - __dirname, - '../modules/search/instant-search/ie11-polyfill.js' - ), - 'ie11-polyfill-payload': [ - require.resolve( 'core-js' ), - require.resolve( 'regenerator-runtime/runtime' ), - require.resolve( 'whatwg-fetch' ), - require.resolve( 'abortcontroller-polyfill/dist/polyfill-patch-fetch' ), - ], }, 'output-chunk-filename': 'jp-search.chunk-[name]-[hash].min.js', 'output-filename': 'jp-search-[name].bundle.js',