Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#61655 closed defect (bug) (duplicate)

HTML API: Audit modified class_name whitespace handling

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

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.


2 years 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:


2 years ago
#3

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

#4 @jonsurrell
2 years ago

  • Milestone 6.7
  • Resolutionduplicate
  • Status assignedclosed

Duplicate of #61531.

Note: See TracTickets for help on using tickets.