Make WordPress Core

Opened 6 months ago

Closed 2 months ago

#42729 closed enhancement (fixed)

Permit use of 'text-transform' in safecss_filter_attr()

Reported by: danielbachhuber Owned by: juiiee8487
Milestone: 5.0 Priority: normal
Severity: normal Version:
Component: Editor Keywords: good-first-bug has-patch has-unit-tests
Focuses: Cc:


As a WordPress user, I'd expect that whitelisting use of the style attribute for <span> elements would permit use of text-transform:lowercase; within the attribute.

However, doing so also requires filtering safe_style_css. Given text-transform is a text formatting property like font-style and text-decoration, it makes sense to also include it in safecss_filter_attr()'s default property set.

Attachments (2)

42729.diff (330 bytes) - added by juiiee8487 6 months ago.
I have created patch to whitelist text-transform CSS property.
42729.2.diff (3.3 KB) - added by birgire 3 months ago.

Download all attachments as: .zip

Change History (9)

#1 @danielbachhuber
6 months ago

  • Keywords good-first-bug added

6 months ago

I have created patch to whitelist text-transform CSS property.

#2 @juiiee8487
6 months ago

  • Keywords has-patch added; needs-patch removed

I have created patch 42729.diff to whitelist text-transform CSS property.

#3 @DrewAPicture
4 months ago

  • Owner set to juiiee8487
  • Status changed from new to assigned

Hi @juiiee8487, thanks for the patch! I've assigned this good-first-bug ticket to you to mark it as "claimed" and somebody should be along to review your patch and give you some feedback on next steps. Sorry for the delay in response.

#4 @juiiee8487
4 months ago

Hi @DrewAPicture, No problem! and Thank you! I am happy to own first ticket :)

3 months ago

#5 @birgire
3 months ago

  • Keywords has-unit-tests added; needs-unit-tests removed

The patch in 42729.diff looks good.

There are currently no explicit tests for the safecss_filter_attr() function.

The patch in 42729.2.diff

  • adds @since in the docblock of the safecss_filter_attr() function.
  • adds tests for the safecss_filter_attr() function with a data provider.

There's a suggested patch by @joehoyle in #24157 for tests, that we could also consider.

But it looks like that patch is blocked by the discussion of allowing parentheses.

#6 @SergeyBiryukov
2 months ago

  • Milestone changed from Future Release to 5.0

#7 @SergeyBiryukov
2 months ago

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

In 42880:

Formatting: Permit use of text-transform in safecss_filter_attr().

Add unit tests for safecss_filter_attr().

Props birgire, juiiee8487, danielbachhuber.
Fixes #42729.

Note: See TracTickets for help on using tickets.