Make WordPress Core


Ignore:
Timestamp:
08/29/2024 06:04:02 AM (7 months ago)
Author:
swissspidy
Message:

Script Loader: Remove importmap polyfill.

The polyfill was added in [57492], but all browsers supported by WordPress already support import maps.

This not only disables the polyfill, but completely removes it as it was only added recently and there is no usage outside of core.

Props swissspidy, desrosj, luisherranz, gziolo.
Fixes #60970.

File:
1 edited

Legend:

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

    r58579 r58952  
    237237        $import_map = $this->get_import_map();
    238238        if ( ! empty( $import_map['imports'] ) ) {
    239             global $wp_scripts;
    240             if ( isset( $wp_scripts ) ) {
    241                 wp_print_inline_script_tag(
    242                     wp_get_script_polyfill(
    243                         $wp_scripts,
    244                         array(
    245                             'HTMLScriptElement.supports && HTMLScriptElement.supports("importmap")' => 'wp-polyfill-importmap',
    246                         )
    247                     ),
    248                     array(
    249                         'id' => 'wp-load-polyfill-importmap',
    250                     )
    251                 );
    252             }
    253239            wp_print_inline_script_tag(
    254240                wp_json_encode( $import_map, JSON_HEX_TAG | JSON_HEX_AMP ),
Note: See TracChangeset for help on using the changeset viewer.