Script Loader: Fix unintended adding of async to scripts that are printed directly with wp_print_scripts() without enqueueing them beforehand.

Props: joemcgill, westonruter, felixarntz, peterwilsoncc.
See: #58648.
Built from https://develop.svn.wordpress.org/trunk@56092


git-svn-id: http://core.svn.wordpress.org/trunk@55604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2023-06-28 14:16:27 +00:00
parent d33f37603e
commit 88a4cf17a6
2 changed files with 13 additions and 3 deletions

View File

@ -907,9 +907,19 @@ JS;
* @return string The best eligible loading strategy.
*/
private function get_eligible_loading_strategy( $handle ) {
$eligible = $this->filter_eligible_strategies( $handle );
$intended = (string) $this->get_data( $handle, 'strategy' );
// Bail early once we know the eligible strategy is blocking.
// Bail early if there is no intended strategy.
if ( ! $intended ) {
return '';
}
// If the intended strategy is 'defer', limit the initial list of eligibles.
$initial = ( 'defer' === $intended ) ? array( 'defer' ) : null;
$eligible = $this->filter_eligible_strategies( $handle, $initial );
// Return early once we know the eligible strategy is blocking.
if ( empty( $eligible ) ) {
return '';
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.3-alpha-56091';
$wp_version = '6.3-alpha-56092';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.