Make WordPress Core

Opened 21 months ago

Closed 21 months ago

Last modified 21 months ago

#56675 closed defect (bug) (fixed)

Extra spaces appear in css queue

Reported by: elten's profile elten Owned by: audrasjb's profile audrasjb
Milestone: 6.1 Priority: normal
Severity: minor Version:
Component: Script Loader Keywords: has-patch has-unit-tests commit
Focuses: coding-standards Cc:


In the css queue, there are two spaces between “id” and “href”, also have this problem in

<link rel='stylesheet' id='wporg-global-fonts-css'  href='' media='all' />
<link rel='stylesheet' id='wporg-parent-2021-style-css'  href='' media='all' />
<link rel='stylesheet' id='wporg-main-2022-style-css'  href='' media='all' />
<link rel='stylesheet' id='wporg-parent-block-styles-css'  href='' media='all' />
<link rel='stylesheet' id='wporg-global-header-footer-css'  href='' media='all' />


WordPress version : 6.0.2
Appears after loading the css queue ( use wp_enqueue_style() ) .
The problem has nothing to do with templates.

Attachments (1)

56675-title.png (22.8 KB) - added by whaze 21 months ago.
link tag with and without title attr

Download all attachments as: .zip

Change History (10)

#1 @audrasjb
21 months ago

  • Keywords needs-patch added

Hello, welcome to WordPress Core Trac and thank you for opening this ticket!

The issue comes from this line. When the third %s placeholder is empty, two spaces are printed.

This ticket was mentioned in PR #3354 on WordPress/wordpress-develop by whaze.

21 months ago

  • Keywords has-patch added; needs-patch removed

#3 @whaze
21 months ago

i submitted a PR : moving the space in the $title var to prevent double space beetween id and href attribute, so the space is still ok when link tag have a title attr

21 months ago

link tag with and without title attr

#4 @audrasjb
21 months ago

  • Keywords changes-requested added

Looks great to me.
By the way, we should also update the related unit tests located in tests/phpunit/tests/dependencies/styles.php @whaze

#5 @whaze
21 months ago

i updated the unit tests

#6 @audrasjb
21 months ago

  • Keywords has-unit-tests commit added; changes-requested removed
  • Milestone changed from Awaiting Review to 6.1
  • Version 6.0.2 deleted

Thanks @whaze, looks great.
Also, thanks @SergeyBiryukov for adding RTL support and for the few small enhancements ✌️

Let's ship this with 6.1.

#7 @audrasjb
21 months ago

  • Component changed from Formatting to Script Loader

#8 @audrasjb
21 months ago

  • Owner set to audrasjb
  • Resolution set to fixed
  • Status changed from new to closed

In 54348:

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.

Note: See TracTickets for help on using tickets.