[wp-trac] [WordPress Trac] #61531: HTML API: Audit class name methods for consistency and correctness (was: HTML API: Tag processor class name methods should behave consistently with case sensitivity)
WordPress Trac
noreply at wordpress.org
Fri Jun 28 19:21:47 UTC 2024
#61531: HTML API: Audit class name methods for consistency and correctness
--------------------------------------+-----------------------------
Reporter: jonsurrell | Owner: (none)
Type: enhancement | Status: assigned
Priority: normal | Milestone: Future Release
Component: HTML API | Version: 6.5
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-----------------------------
Changes (by jonsurrell):
* owner: jonsurrell => (none)
* type: defect (bug) => enhancement
* milestone: 6.7 => Future Release
Old description:
> The Tag Processor CSS class name methods `class_list`, `add_class`, and
> `remove_class` should be consistent regarding case sensitivity.
>
> These methods are intended to align with CSS class names, meaning that
> matching should be done ASCII case-insensitive. `class_list` already
> yields lower case unique class names, but `remove_class` and `add_class`
> do not have similar behavior of treating case-insensitive matching
> classes as equal.
>
> - `add_class` should only add classes that are not already present
> (compared ASCII case-insensitive).
> - `remove_class` should remove all matching classes (compared ASCII case-
> insensitive).
>
> This was discussed with @dmsnell on Slack here:
> https://wordpress.slack.com/archives/C05NFB818PQ/p1719403633636769
>
> Related to #61520 which documents the lower-casing behavior of
> `class_list`.
New description:
The Tag Processor CSS class name methods `class_list`, `add_class`,
`remove_class`, and `has_class`. These should behave consistently
regarding case-sensistivity.
These methods are intended to align with CSS class selectors. CSS class
selector matching behavior is complicated and may depend on the document.
This makes it difficult to determine the correct behavior for these
methods.
At the moment, `class_list` yields ASCII lower-cased class names, but
`remove_class` and `add_class` match case sensitive class names.
--
Comment:
After further review, it's difficult to determine exactly the correct
behavior of these class methods should be. I've updated the summary to
talk about auditing the behavior and I've changed the milestone to "future
release."
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61531#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list