Make WordPress Core

Changeset 50934


Ignore:
Timestamp:
05/19/2021 07:59:55 PM (8 months ago)
Author:
desrosj
Message:

Script Loader: Stop loading polyfills specific to Internet Explorer

This change removes the inline JavaScript attached to the wp-polyfill script responsible for loading polyfill libraries included specifically for Internet Explorer support.

Support for the final version of IE supported in WordPress Core (IE11) was removed in [50784] and will on longer be supported when the next version of WordPress is released.

These scripts are still registered and available to be enqueued, but WordPress will no longer load them by default.

For more information, see https://wordpress.org/news/2021/05/dropping-support-for-internet-explorer-11/.

Props youknowriad, gziolo, sergiomdgomes, desrosj.
Fixes #53078.

Location:
trunk
Files:
2 edited

Legend:

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

    r50919 r50934  
    123123
    124124    $scripts->add( 'wp-polyfill', null, array( 'wp-polyfill' ) );
    125     did_action( 'init' ) && $scripts->add_inline_script(
    126         'wp-polyfill',
    127         wp_get_script_polyfill(
    128             $scripts,
    129             array(
    130                 '\'fetch\' in window' => 'wp-polyfill-fetch',
    131                 'document.contains'   => 'wp-polyfill-node-contains',
    132                 'window.DOMRect'      => 'wp-polyfill-dom-rect',
    133                 'window.URL && window.URL.prototype && window.URLSearchParams' => 'wp-polyfill-url',
    134                 'window.FormData && window.FormData.prototype.keys' => 'wp-polyfill-formdata',
    135                 'Element.prototype.matches && Element.prototype.closest' => 'wp-polyfill-element-closest',
    136                 '\'objectFit\' in document.documentElement.style' => 'wp-polyfill-object-fit',
    137             )
    138         )
    139     );
    140125
    141126    did_action( 'init' ) && $scripts->add_inline_script( 'lodash', 'window.lodash = _.noConflict();' );
  • trunk/tests/phpunit/tests/dependencies/scripts.php

    r50441 r50934  
    724724        $ver       = get_bloginfo( 'version' );
    725725        $suffix    = wp_scripts_get_suffix();
    726         $expected  = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5Bchunk_0%5D=jquery-core,jquery-migrate&amp;ver={$ver}'></script>\n";
     726        $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={$ver}'></script>\n";
    727727        $expected .= "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
    728728        $expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
    729         $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/vendor/wp-polyfill{$suffix}.js' id='wp-polyfill-js'></script>\n";
    730         $expected .= "<script type='text/javascript' id='wp-polyfill-js-after'>\n";
    731         $expected .= "( 'fetch' in window ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-fetch{$suffix}.js\"></scr' + 'ipt>' );( document.contains ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-node-contains{$suffix}.js\"></scr' + 'ipt>' );( window.DOMRect ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-dom-rect{$suffix}.js\"></scr' + 'ipt>' );( window.URL && window.URL.prototype && window.URLSearchParams ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-url{$suffix}.js\"></scr' + 'ipt>' );( window.FormData && window.FormData.prototype.keys ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-formdata{$suffix}.js\"></scr' + 'ipt>' );( Element.prototype.matches && Element.prototype.closest ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-element-closest{$suffix}.js\"></scr' + 'ipt>' );( 'objectFit' in document.documentElement.style ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-object-fit{$suffix}.js\"></scr' + 'ipt>' );\n";
    732         $expected .= "</script>\n";
    733         $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/dom-ready{$suffix}.js' id='wp-dom-ready-js'></script>\n";
    734         $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/hooks{$suffix}.js' id='wp-hooks-js'></script>\n";
    735729        $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/i18n{$suffix}.js' id='wp-i18n-js'></script>\n";
    736730        $expected .= "<script type='text/javascript' id='wp-i18n-js-after'>\n";
Note: See TracChangeset for help on using the changeset viewer.