wp_get_script_polyfill example

// Register the IE11 polyfill loader.     wp_register_script(
        'twenty-twenty-one-ie11-polyfills',
        null,
        array(),
        wp_get_theme()->get( 'Version' ),
        true
    );
    wp_add_inline_script(
        'twenty-twenty-one-ie11-polyfills',
        wp_get_script_polyfill(
            $wp_scripts,
            array(
                'Element.prototype.matches && Element.prototype.closest && window.NodeList && NodeList.prototype.forEach' => 'twenty-twenty-one-ie11-polyfills-asset',
            )
        )
    );

    // Main navigation scripts.     if ( has_nav_menu( 'primary' ) ) {
        wp_enqueue_script(
            'twenty-twenty-one-primary-navigation-script',
            
Home | Imprint | This part of the site doesn't use cookies.