Script Loader: Fix logic inversion with $html5_script_support in wp_sanitize_script_attributes().

The value was actually whether HTML5 was ''not'' supported.

Follow-up to [50167].

Props jamieburchell, sabernhardt.
See #39941.
Fixes #64128.

Built from https://develop.svn.wordpress.org/trunk@61052


git-svn-id: http://core.svn.wordpress.org/trunk@60388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter
2025-10-22 22:33:32 +00:00
parent 9b0c8e3cf7
commit ef01f4281c
2 changed files with 3 additions and 3 deletions

View File

@@ -2869,7 +2869,7 @@ function wp_enqueue_editor_format_library_assets() {
* @return string String made of sanitized `<script>` tag attributes.
*/
function wp_sanitize_script_attributes( $attributes ) {
$html5_script_support = ! is_admin() && ! current_theme_supports( 'html5', 'script' );
$html5_script_support = is_admin() || current_theme_supports( 'html5', 'script' );
$attributes_string = '';
/*
@@ -2879,7 +2879,7 @@ function wp_sanitize_script_attributes( $attributes ) {
foreach ( $attributes as $attribute_name => $attribute_value ) {
if ( is_bool( $attribute_value ) ) {
if ( $attribute_value ) {
$attributes_string .= $html5_script_support ? sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_name ) ) : ' ' . esc_attr( $attribute_name );
$attributes_string .= $html5_script_support ? ' ' . esc_attr( $attribute_name ) : sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_name ) );
}
} else {
$attributes_string .= sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_value ) );

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.9-beta1-61051';
$wp_version = '6.9-beta1-61052';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.