Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
dbcd32c
Output script modules with fetchpriority=low
westonruter May 19, 2025
5207c27
Fix duplicate array keys in data_special_chars_script_encoding
westonruter May 19, 2025
088366d
Add ability to set fetch priority for script modules
westonruter May 19, 2025
9eab85d
Add fetchpriority support for non-module scripts
westonruter May 19, 2025
d9c4037
Set fetchpriority=low on comment-reply script
westonruter May 19, 2025
4f82a4f
Use auto as default fetchpriority for script modules
westonruter May 19, 2025
f2cd9be
Avoid printing fetchpriority attribute when auto
westonruter May 19, 2025
ff4fd36
fixup! Use auto as default fetchpriority for script modules
westonruter May 19, 2025
9edbe4c
Use HTML Tag Processor to parse import map
westonruter May 19, 2025
021fe74
Ensure parity in args between class methods and global function aliases
westonruter May 19, 2025
34ef7fa
Use fetch priority low by default for Interactivity API view script m…
westonruter May 20, 2025
e54274a
Add missing since tag
westonruter May 21, 2025
cc1d909
Account for full block.json schema when checking for interactivity
westonruter May 21, 2025
4197eb2
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter Jun 20, 2025
74a49e1
Remove PHPStan annotations for commit
westonruter Jun 20, 2025
75fb879
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter Jul 29, 2025
0e9994a
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter Aug 26, 2025
06e9cac
Remove TODO comments which have been filed in https://github.com/Word…
westonruter Aug 26, 2025
f91c61d
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter Sep 1, 2025
4596644
Add validation for fetchpriority set on scripts
westonruter Sep 2, 2025
2172e9e
Allow empty string for set_fetchpriority(), return bool, and add tests
westonruter Sep 2, 2025
535669d
Add missing type for args param
westonruter Sep 2, 2025
fe366e2
Improve typing for is_delayed_stragegy
westonruter Sep 2, 2025
f704f5e
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter Sep 2, 2025
38150dc
Replace n.e.x.t with 6.9.0
westonruter Sep 2, 2025
f05ca72
Ensure reflection property is accessible
westonruter Sep 2, 2025
607ce0c
Use static data provider methods
westonruter Sep 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ensure parity in args between class methods and global function aliases
  • Loading branch information
westonruter committed May 19, 2025
commit 021fe74eca456ff87a8b62af93bc8560849860ae
9 changes: 7 additions & 2 deletions src/wp-includes/class-wp-script-modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,17 @@ public function set_fetchpriority( string $id, string $priority ) {
* It is added to the URL as a query string for cache busting purposes. If $version
* is set to false, the version number is the currently installed WordPress version.
* If $version is set to null, no version is added.
* @param array $args {
* Optional. An array of additional args. Default empty array.
*
* @type 'auto'|'low'|'high' $fetchpriority Fetch priority. Default 'auto'. Optional.
* }
*/
public function enqueue( string $id, string $src = '', array $deps = array(), $version = false ) {
public function enqueue( string $id, string $src = '', array $deps = array(), $version = false, $args = array() ) {
if ( isset( $this->registered[ $id ] ) ) {
$this->registered[ $id ]['enqueue'] = true;
} elseif ( $src ) {
$this->register( $id, $src, $deps, $version );
$this->register( $id, $src, $deps, $version, $args );
$this->registered[ $id ]['enqueue'] = true;
} else {
$this->enqueued_before_registered[ $id ] = true;
Expand Down
18 changes: 14 additions & 4 deletions src/wp-includes/script-modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@ function wp_script_modules(): WP_Script_Modules {
* It is added to the URL as a query string for cache busting purposes. If $version
* is set to false, the version number is the currently installed WordPress version.
* If $version is set to null, no version is added.
* @param array $args {
* Optional. An array of additional args. Default empty array.
*
* @type 'auto'|'low'|'high' $fetchpriority Fetch priority. Default 'auto'. Optional.
* }
*/
function wp_register_script_module( string $id, string $src, array $deps = array(), $version = false ) {
wp_script_modules()->register( $id, $src, $deps, $version );
function wp_register_script_module( string $id, string $src, array $deps = array(), $version = false, array $args = array() ) {
wp_script_modules()->register( $id, $src, $deps, $version, $args );
}

/**
Expand Down Expand Up @@ -97,9 +102,14 @@ function wp_register_script_module( string $id, string $src, array $deps = array
* It is added to the URL as a query string for cache busting purposes. If $version
* is set to false, the version number is the currently installed WordPress version.
* If $version is set to null, no version is added.
* @param array $args {
* Optional. An array of additional args. Default empty array.
*
* @type 'auto'|'low'|'high' $fetchpriority Fetch priority. Default 'auto'. Optional.
* }
*/
function wp_enqueue_script_module( string $id, string $src = '', array $deps = array(), $version = false ) {
wp_script_modules()->enqueue( $id, $src, $deps, $version );
function wp_enqueue_script_module( string $id, string $src = '', array $deps = array(), $version = false, array $args = array() ) {
wp_script_modules()->enqueue( $id, $src, $deps, $version, $args );
}

/**
Expand Down
Loading