-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTML API: Remove leading whitespace removing class names #6933
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@dmsnell How do you feel about moving ahead with this now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this seems like a reasonable change that makes the class attribute prettier without adding much complexity. Fine to merge in IMO.
In part of a larger review of CSS semantics and behaviors, this patch takes the opportunity to remove leading whitespace in an updated class attribute after the first class in the attribute has been removed. Previously, if the first class name had been removed, the whitespace that formerly followed it would remain in the class attribute. This stood in contrast to removing other class names, which removed their associated whitespace. There should be no semantic or functional changes in this patch, only a slightly-large diff for modified HTML documents that looks prettier when removing the first class name in a class attribute. Developed in #6933 Discussed in https://core.trac.wordpress.org/ticket/61531 Props dmsnell, jonsurrell. See #61531. git-svn-id: https://develop.svn.wordpress.org/trunk@58740 602fd350-edb4-49c9-b593-d223f7449a82
In part of a larger review of CSS semantics and behaviors, this patch takes the opportunity to remove leading whitespace in an updated class attribute after the first class in the attribute has been removed. Previously, if the first class name had been removed, the whitespace that formerly followed it would remain in the class attribute. This stood in contrast to removing other class names, which removed their associated whitespace. There should be no semantic or functional changes in this patch, only a slightly-large diff for modified HTML documents that looks prettier when removing the first class name in a class attribute. Developed in WordPress/wordpress-develop#6933 Discussed in https://core.trac.wordpress.org/ticket/61531 Props dmsnell, jonsurrell. See #61531. Built from https://develop.svn.wordpress.org/trunk@58740 git-svn-id: http://core.svn.wordpress.org/trunk@58142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In part of a larger review of CSS semantics and behaviors, this patch takes the opportunity to remove leading whitespace in an updated class attribute after the first class in the attribute has been removed. Previously, if the first class name had been removed, the whitespace that formerly followed it would remain in the class attribute. This stood in contrast to removing other class names, which removed their associated whitespace. There should be no semantic or functional changes in this patch, only a slightly-large diff for modified HTML documents that looks prettier when removing the first class name in a class attribute. Developed in WordPress/wordpress-develop#6933 Discussed in https://core.trac.wordpress.org/ticket/61531 Props dmsnell, jonsurrell. See #61531. Built from https://develop.svn.wordpress.org/trunk@58740 git-svn-id: https://core.svn.wordpress.org/trunk@58142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In part of a larger review of CSS semantics and behaviors, this patch takes the opportunity to remove leading whitespace in an updated class attribute after the first class in the attribute has been removed. Previously, if the first class name had been removed, the whitespace that formerly followed it would remain in the class attribute. This stood in contrast to removing other class names, which removed their associated whitespace. There should be no semantic or functional changes in this patch, only a slightly-large diff for modified HTML documents that looks prettier when removing the first class name in a class attribute. Developed in WordPress#6933 Discussed in https://core.trac.wordpress.org/ticket/61531 Props dmsnell, jonsurrell. See #61531. git-svn-id: https://develop.svn.wordpress.org/trunk@58740 602fd350-edb4-49c9-b593-d223f7449a82
The HTML API
remove_class
regarding white space opts to maintain "inter-class" whitespace.wordpress-develop/src/wp-includes/html-api/class-wp-html-tag-processor.php
Lines 2223 to 2230 in 5effffc
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.
Ticket: https://core.trac.wordpress.org/ticket/61655Trac ticket: https://core.trac.wordpress.org/ticket/61531
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.