Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#54699 closed enhancement (fixed)

dir, lang, and xml:lang should be global attributes supported on all tags

Reported by: upsuper's profile upsuper Owned by: audrasjb's profile audrasjb
Milestone: 6.0 Priority: normal
Severity: normal Version:
Component: Formatting Keywords: has-patch has-unit-tests needs-docs needs-dev-note commit
Focuses: Cc:

Description

Currently in kses, dir, lang, and xml:lang are only supported in several selected elements, however, as can be found in the HTML standard, they are all global attributes and can be applied to any element.

It doesn't make sense, for example, to have to write <span lang="ja"><em>こんにちは</em></span> while you can pretty much just use <em lang="ja">こんにちは</em>.

Change History (14)

This ticket was mentioned in PR #2087 on WordPress/wordpress-develop by upsuper.


2 years ago
#1

  • Keywords has-patch has-unit-tests added

This PR moves dir, lang, and xml:lang attributes into the global attributes in kses so that they can be used with any tag as specified in the HTML standard.

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

#2 @SergeyBiryukov
2 years ago

  • Milestone changed from Awaiting Review to 6.0

#3 @mukesh27
2 years ago

  • Keywords needs-docs needs-refresh added

Hi there!

Thanks for the ticket and patch!

In the PR we should add document for _wp_add_global_attributes() function. Something like:

* @since 6.0.0 Add global support for `dir`, `lang`, and `xml:lang` attributes.

#4 @upsuper
2 years ago

  • Keywords needs-refresh removed

Updated the PR to include that item.

#6 @audrasjb
2 years ago

  • Keywords needs-dev-note added
  • Owner set to audrasjb
  • Status changed from new to accepted

I added a PR to refresh the patch and to add forgotten items.

#7 @audrasjb
2 years ago

@SergeyBiryukov would you mind reviewing the above PR please?
I think we're good, but just want to double check before shipping this change.

#8 @upsuper
2 years ago

Any update here?

#9 @audrasjb
2 years ago

Hello @upsuper, thanks for the heads up.
I think we're good to go.
I self assigned the ticket but I'm only waiting for another committer review before shipping it to milestone 6.0.

SergeyBiryukov commented on PR #2193:


2 years ago
#10

Thanks for the refreshed PR! This looks good to me, just added some more WPCS fixes and formatting adjustments.

#11 @SergeyBiryukov
2 years ago

  • Keywords commit added

peterwilsoncc commented on PR #2087:


2 years ago
#12

Superseded by #2193

#13 @peterwilsoncc
2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 52968:

KSES: Allow lang, xml:lang, dir attributes globally.

Globally permit the lang, xml:lang, and dir attributes on all elements rather than a subset in accordance with the HTML specification.

Props upsuper, SergeyBiryukov, mukesh27, audrasjb.
Fixes #54699.

peterwilsoncc commented on PR #2193:


2 years ago
#14

Committed in e7a9f9df4e13b94187ea362f55ddfdaa0f6911f3 (canonically https://core.trac.wordpress.org/changeset/52968)

Note: See TracTickets for help on using tickets.