Skip to content

Commit 96cfff9

Browse files
committed
Script Loader: Escape HTML5 boolean attribute names.
Add escaping of boolean attribute names in `wp_sanitize_script_attributes()` for themes supporting HTML5 script elements. Props tmatsuur, johnbillion, joyously. Merges [50575] to the 5.7 branch. Fixes #52894. git-svn-id: https://develop.svn.wordpress.org/branches/5.7@50661 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 2fa8eb4 commit 96cfff9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/wp-includes/script-loader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2353,7 +2353,7 @@ function wp_sanitize_script_attributes( $attributes ) {
23532353
foreach ( $attributes as $attribute_name => $attribute_value ) {
23542354
if ( is_bool( $attribute_value ) ) {
23552355
if ( $attribute_value ) {
2356-
$attributes_string .= $html5_script_support ? sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_name ) ) : ' ' . $attribute_name;
2356+
$attributes_string .= $html5_script_support ? sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_name ) ) : ' ' . esc_attr( $attribute_name );
23572357
}
23582358
} else {
23592359
$attributes_string .= sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_value ) );

0 commit comments

Comments
 (0)