Make WordPress Core

Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#61655 closed defect (bug) (duplicate)

HTML API: Audit modified class_name whitespace handling

Reported by: jonsurrell's profile jonsurrell Owned by: jonsurrell's profile jonsurrell
Milestone: Priority: normal
Severity: normal Version:
Component: HTML API Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

When the HTML API modifies the class property via some of the class name oriented methods, the resulting whitespace may be inconsistent. For example, trailing whitespace is trimmed while leading whitespace is removed.

Audit this behavior to ensure it is clear and consistent.

See this Slack conversation for some discussion.

Change History (5)

This ticket was mentioned in PR #6933 on WordPress/wordpress-develop by @jonsurrell.


10 months ago
#1

  • Keywords has-patch has-unit-tests added

The HTML API remove_class regarding white space opts to maintain "inter-class" whitespace.

https://github.com/WordPress/wordpress-develop/blob/5effffccd005ca3dae6631ee73b1096b8f54a861/src/wp-includes/html-api/class-wp-html-tag-processor.php#L2223-L2230

This seems reasonable and justified, but normalization seems inconsistent. Leading space is maintained, but trailing space is not.

It seems more consistent to trim leading and trailing space, and actually maintain _only_ inter-class whitespace.

Trac ticket: https://core.trac.wordpress.org/ticket/61655

@jonsurrell commented on PR #6933:


10 months ago
#3

@dmsnell How do you feel about moving ahead with this now?

#4 @jonsurrell
10 months ago

  • Milestone 6.7 deleted
  • Resolution set to duplicate
  • Status changed from assigned to closed

Duplicate of #61531.

Note: See TracTickets for help on using tickets.