Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#43465 closed defect (bug) (fixed)

Remove an extra space in the admin body class.

Reported by: birgire's profile birgire Owned by: ocean90's profile ocean90
Milestone: 5.1 Priority: lowest
Severity: normal Version:
Component: Administration Keywords: good-first-bug has-patch
Focuses: Cc:

Description

I just noticed that there's an extra space in the admin body class.

Here's an example on wp-admin/index.php:

<body class="wp-admin wp-core-ui no-js  index-php ...">

This is generated in wp-admin/admin-header.php with:

<body class="wp-admin wp-core-ui no-js <?php echo $admin_body_classes . ' ' . $admin_body_class ?>">

There's no harm in extra spaces between classes, but it could be fix it with a ltrim() or trim() to cover both ends.

Example:

<body class="wp-admin wp-core-ui no-js <?php echo trim( $admin_body_classes . ' ' . $admin_body_class ); ?>">

Maybe there are other ways or we could just leave it as is?

Attachments (4)

43465.diff (2.0 KB) - added by jainnidhi 7 years ago.
43465.2.diff (2.1 KB) - added by rhetorical 7 years ago.
43465.3.diff (756 bytes) - added by lbenicio 7 years ago.
43465.4.diff (2.0 KB) - added by jainnidhi 7 years ago.
I've already added the patch 43465.diff for this fix but I've used the coding standards in this patch.

Download all attachments as: .zip

Change History (13)

@jainnidhi
7 years ago

#1 @jainnidhi
7 years ago

  • Keywords has-patch added

#2 @omerblink
7 years ago

If I want to contribute in this ticket what should I do?

Sorry about the silly question... I'm new in contribution

#3 @birgire
7 years ago

Thanks for the patch @jainnidhi

@omerblink welcome to WordPress Trac.

If you're looking for general info, then a good starting point is the Core Contributor Handbook:

https://make.wordpress.org/core/handbook/

There's also the New Contributors Chat in Slack #core

See also:

https://make.wordpress.org/meetings/

https://make.wordpress.org/core/tag/new-contributors/

... or to dive right in then I would suggest adjusting 43465.diff to the Coding standards, i.e. like adding extra space for the function input (see here).

Note that it's still an open question if this ticket should be fixed or not.

Hope it helps.

#4 @nielslange
7 years ago

  • Keywords needs-testing added

@rhetorical
7 years ago

#5 @rhetorical
7 years ago

43465.2.diff updates the original patch to add extra space to the function for the coding standards that @birgire had mentioned

@lbenicio
7 years ago

#6 @mathieuhays
7 years ago

I've tested the patch 43465.3.diff. It introduces a syntax error and doesn't comply to the WordPress Coding Standards.

I've tested 43465.2.diff locally, it solves the issue and does comply to the WordPress Coding Standards.

@jainnidhi
7 years ago

I've already added the patch 43465.diff for this fix but I've used the coding standards in this patch.

#7 @ocean90
7 years ago

  • Keywords needs-testing removed
  • Milestone changed from Awaiting Review to 5.0

#8 @ocean90
7 years ago

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

In 42974:

Administration: Avoid an extra space in the admin body class.

Props jainnidhi, rhetorical, birgire, mathieuhays.
Fixes #43465.

#9 @pento
7 years ago

  • Milestone changed from 5.0 to 5.1
Note: See TracTickets for help on using tickets.