Make WordPress Core


Ignore:
Timestamp:
03/07/2024 07:06:53 AM (2 months ago)
Author:
adamsilverstein
Message:

Script loader: enable fetchpriority attribute in the wp_preload_resources filter.

Add fetchpriority to the attributes accepted by the wp_preload_resources filter. Developers can now use this filter to set fetchpriority for resources being preloaded.

Props nihar007, luboslives, tabrisrp.
Fixes #58510.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/general/wpPreloadResources.php

    r56547 r57789  
    248248                ),
    249249            ),
     250            'fetchpriority'          => array(
     251                'expected'  => "<link rel='preload' href='https://example.com/image.jpg' as='image' fetchpriority='high' />\n",
     252                'resources' => array(
     253                    array(
     254                        'href'          => 'https://example.com/image.jpg',
     255                        'as'            => 'image',
     256                        'fetchpriority' => 'high',
     257                    ),
     258                ),
     259            ),
    250260        );
    251261    }
Note: See TracChangeset for help on using the changeset viewer.