Skip to content
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

Update 6.1 CSS filter to match core #44962

Merged
merged 1 commit into from
Oct 14, 2022

Conversation

andrewserong
Copy link
Contributor

@andrewserong andrewserong commented Oct 14, 2022

What?

Follow up to #43004 to backport a backport of the CSS filter from 6.1. This copies over the logic from https://github.com/WordPress/wordpress-develop/blob/2b4d385298504d412e9f0dea2e7019d53463c705/src/wp-includes/kses.php#L2504-L2512 in core, to make sure that Gutenberg + WP 6.0 has the same support for CSS functions as 6.1.

Why?

The previous version of this code wasn't current with core, and had edge cases that weren't allowed, as discussed in #43070 (comment).

How?

Copy + paste the lines from https://github.com/WordPress/wordpress-develop/blob/2b4d385298504d412e9f0dea2e7019d53463c705/src/wp-includes/kses.php#L2504-L2512 in core.

Testing Instructions

  • Ensure that style engine tests still pass, e.g.
    'background:var(--wp--preset--color--primary, 10px);font-size:clamp(36.00rem, calc(32.00rem + 10.00vw), 40.00rem);width:min(150vw, 100px);min-width:max(150vw, 100px);max-width:minmax(400px, 50%);padding:calc(80px * -1);background-image:url("https://wordpress.org");--wp--style--unstable-gallery-gap:12em;border-width:2000.75em;',
  • Smoke test that layout styles on the site frontend are still working as expected
  • Check that the copy+pasted lines are copy+pasted correctly 😀

Copy link
Member

@ramonjd ramonjd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested as part of #44961 😄 and following the tests in #43004

All unit tests pass

Thank you!!!

@ramonjd ramonjd merged commit 35f04fa into trunk Oct 14, 2022
@ramonjd ramonjd deleted the update/6-1-safecss-filter-to-match-core branch October 14, 2022 06:56
@github-actions github-actions bot added this to the Gutenberg 14.4 milestone Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Style Engine /packages/style-engine [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants