Script Loader: Prevent double space between attributes in `WP_Styles` class.

This changeset prevents `<link />` elements to display a double space between attributes when no `title` attribute is provided.

Props elten, audrasjb, whaze, SergeyBiryukov.
Fixes #56675.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2022-09-28 14:59:10 +00:00
parent 525c52c873
commit f8bd8914da
2 changed files with 4 additions and 4 deletions

View File

@ -224,10 +224,10 @@ class WP_Styles extends WP_Dependencies {
} }
$rel = isset( $obj->extra['alt'] ) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet'; $rel = isset( $obj->extra['alt'] ) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
$title = isset( $obj->extra['title'] ) ? sprintf( "title='%s'", esc_attr( $obj->extra['title'] ) ) : ''; $title = isset( $obj->extra['title'] ) ? sprintf( " title='%s'", esc_attr( $obj->extra['title'] ) ) : '';
$tag = sprintf( $tag = sprintf(
"<link rel='%s' id='%s-css' %s href='%s'%s media='%s' />\n", "<link rel='%s' id='%s-css'%s href='%s'%s media='%s' />\n",
$rel, $rel,
$handle, $handle,
$title, $title,
@ -259,7 +259,7 @@ class WP_Styles extends WP_Dependencies {
} }
$rtl_tag = sprintf( $rtl_tag = sprintf(
"<link rel='%s' id='%s-rtl-css' %s href='%s'%s media='%s' />\n", "<link rel='%s' id='%s-rtl-css'%s href='%s'%s media='%s' />\n",
$rel, $rel,
$handle, $handle,
$title, $title,

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.1-beta2-54347'; $wp_version = '6.1-beta2-54348';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.