Skip to content

Commit 241357d

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@61052 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d0c86cd commit 241357d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/wp-includes/script-loader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2869,7 +2869,7 @@ function wp_enqueue_editor_format_library_assets() {
28692869
* @return string String made of sanitized `<script>` tag attributes.
28702870
*/
28712871
function wp_sanitize_script_attributes( $attributes ) {
2872-
$html5_script_support = ! is_admin() && ! current_theme_supports( 'html5', 'script' );
2872+
$html5_script_support = is_admin() || current_theme_supports( 'html5', 'script' );
28732873
$attributes_string = '';
28742874

28752875
/*
@@ -2879,7 +2879,7 @@ function wp_sanitize_script_attributes( $attributes ) {
28792879
foreach ( $attributes as $attribute_name => $attribute_value ) {
28802880
if ( is_bool( $attribute_value ) ) {
28812881
if ( $attribute_value ) {
2882-
$attributes_string .= $html5_script_support ? sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_name ) ) : ' ' . esc_attr( $attribute_name );
2882+
$attributes_string .= $html5_script_support ? ' ' . esc_attr( $attribute_name ) : sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_name ) );
28832883
}
28842884
} else {
28852885
$attributes_string .= sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_value ) );

0 commit comments

Comments
 (0)