mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-10 15:44:29 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@56092 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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 '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user