Changeset 57789
- Timestamp:
- 03/07/2024 07:06:53 AM (9 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/general-template.php
r57644 r57789 3580 3580 * 3581 3581 * @since 6.1.0 3582 * @since 6.6.0 Added the `$fetchpriority` attribute. 3582 3583 * 3583 3584 * @param array $preload_resources { … … 3587 3588 * Array of resource attributes. 3588 3589 * 3589 * @type string $href URL to include in resource preloads. Required. 3590 * @type string $as How the browser should treat the resource 3591 * (`script`, `style`, `image`, `document`, etc). 3592 * @type string $crossorigin Indicates the CORS policy of the specified resource. 3593 * @type string $type Type of the resource (`text/html`, `text/css`, etc). 3594 * @type string $media Accepts media types or media queries. Allows responsive preloading. 3595 * @type string $imagesizes Responsive source size to the source Set. 3596 * @type string $imagesrcset Responsive image sources to the source set. 3590 * @type string $href URL to include in resource preloads. Required. 3591 * @type string $as How the browser should treat the resource 3592 * (`script`, `style`, `image`, `document`, etc). 3593 * @type string $crossorigin Indicates the CORS policy of the specified resource. 3594 * @type string $type Type of the resource (`text/html`, `text/css`, etc). 3595 * @type string $media Accepts media types or media queries. Allows responsive preloading. 3596 * @type string $imagesizes Responsive source size to the source Set. 3597 * @type string $imagesrcset Responsive image sources to the source set. 3598 * @type string $fetchpriority Fetchpriority value for the resource. 3597 3599 * } 3598 3600 * } … … 3642 3644 3643 3645 // Ignore non-supported attributes. 3644 $non_supported_attributes = array( 'as', 'crossorigin', 'href', 'imagesrcset', 'imagesizes', 'type', 'media' );3646 $non_supported_attributes = array( 'as', 'crossorigin', 'href', 'imagesrcset', 'imagesizes', 'type', 'media', 'fetchpriority' ); 3645 3647 if ( ! in_array( $resource_key, $non_supported_attributes, true ) && ! is_numeric( $resource_key ) ) { 3646 3648 continue; -
trunk/tests/phpunit/tests/general/wpPreloadResources.php
r56547 r57789 248 248 ), 249 249 ), 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 ), 250 260 ); 251 261 }
Note: See TracChangeset
for help on using the changeset viewer.