Make WordPress Core


Ignore:
Timestamp:
02/12/2026 07:56:42 PM (2 months ago)
Author:
joedolson
Message:

Twenty Twenty One: Remove support for Internet Explorer.

No version of Internet Explorer is still supported by WordPress or Microsoft. Usage of Internet Explorer has dropped to about 0.1%.

Remove IE-specific CSS and polyfills.

Props sabernhardt, westonruter, mukesh27, joedolson.
Fixes #64590.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwentyone/functions.php

    r61302 r61628  
    2424     *
    2525     * @since Twenty Twenty-One 1.0
     26     * @since Twenty Twenty-One 2.8 Removed editor stylesheet for Internet Explorer.
    2627     *
    2728     * @return void
     
    124125        }
    125126
    126         $editor_stylesheet_path = './assets/css/style-editor.css';
    127 
    128         // Note, the is_IE global variable is defined by WordPress and is used
    129         // to detect if the current browser is internet explorer.
    130         global $is_IE;
    131         if ( $is_IE ) {
    132             $editor_stylesheet_path = './assets/css/ie-editor.css';
    133         }
    134 
    135127        // Enqueue editor styles.
    136         add_editor_style( $editor_stylesheet_path );
     128        add_editor_style( './assets/css/style-editor.css' );
    137129
    138130        // Add custom editor font sizes.
     
    391383 *
    392384 * @since Twenty Twenty-One 1.0
    393  *
    394  * @global bool       $is_IE
    395  * @global WP_Scripts $wp_scripts
     385 * @since Twenty Twenty-One 2.8 Removed Internet Explorer support.
    396386 *
    397387 * @return void
    398388 */
    399389function twenty_twenty_one_scripts() {
    400     // Note, the is_IE global variable is defined by WordPress and is used
    401     // to detect if the current browser is internet explorer.
    402     global $is_IE, $wp_scripts;
    403     if ( $is_IE ) {
    404         // If IE 11 or below, use a flattened stylesheet with static values replacing CSS Variables.
    405         wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/assets/css/ie.css', array(), wp_get_theme()->get( 'Version' ) );
    406     } else {
    407         // If not IE, use the standard stylesheet.
    408         wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
    409     }
     390    // The standard stylesheet.
     391    wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
    410392
    411393    // RTL styles.
     
    420402    }
    421403
    422     // Register the IE11 polyfill file.
     404    // Register the handles for unused IE11 polyfill scripts.
    423405    wp_register_script(
    424406        'twenty-twenty-one-ie11-polyfills-asset',
    425         get_template_directory_uri() . '/assets/js/polyfills.js',
     407        false,
    426408        array(),
    427409        wp_get_theme()->get( 'Version' ),
    428410        array( 'in_footer' => true )
    429411    );
    430 
    431     // Register the IE11 polyfill loader.
    432412    wp_register_script(
    433413        'twenty-twenty-one-ie11-polyfills',
    434         null,
     414        false,
    435415        array(),
    436416        wp_get_theme()->get( 'Version' ),
    437417        array( 'in_footer' => true )
    438     );
    439     wp_add_inline_script(
    440         'twenty-twenty-one-ie11-polyfills',
    441         wp_get_script_polyfill(
    442             $wp_scripts,
    443             array(
    444                 'Element.prototype.matches && Element.prototype.closest && window.NodeList && NodeList.prototype.forEach' => 'twenty-twenty-one-ie11-polyfills-asset',
    445             )
    446         )
    447418    );
    448419
     
    452423            'twenty-twenty-one-primary-navigation-script',
    453424            get_template_directory_uri() . '/assets/js/primary-navigation.js',
    454             array( 'twenty-twenty-one-ie11-polyfills' ),
     425            array(),
    455426            wp_get_theme()->get( 'Version' ),
    456427            array(
     
    465436        'twenty-twenty-one-responsive-embeds-script',
    466437        get_template_directory_uri() . '/assets/js/responsive-embeds.js',
    467         array( 'twenty-twenty-one-ie11-polyfills' ),
     438        array(),
    468439        wp_get_theme()->get( 'Version' ),
    469440        array( 'in_footer' => true )
     
    631602 *
    632603 * @since Twenty Twenty-One 1.0
     604 * @deprecated Twenty Twenty-One 2.8 Removed Internet Explorer support.
    633605 *
    634606 * @return void
     
    648620    }
    649621}
    650 add_action( 'wp_footer', 'twentytwentyone_add_ie_class' );
    651622
    652623if ( ! function_exists( 'wp_get_list_item_separator' ) ) :
Note: See TracChangeset for help on using the changeset viewer.