#61655 closed defect (bug) (duplicate)
HTML API: Audit modified class_name whitespace handling
Reported by: | jonsurrell | Owned by: | 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.
Change History (5)
This ticket was mentioned in PR #6933 on WordPress/wordpress-develop by @jonsurrell.
8 weeks ago
#1
- Keywords has-patch has-unit-tests added
@jonsurrell commented on PR #6933:
8 weeks ago
#2
@jonsurrell commented on PR #6933:
8 weeks ago
#3
@dmsnell How do you feel about moving ahead with this now?
Note: See
TracTickets for help on using
tickets.
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