From e01a0f987ae485cc93d576903a05070faa6cd2a2 Mon Sep 17 00:00:00 2001 From: wildworks Date: Fri, 19 Jun 2026 06:42:44 +0000 Subject: [PATCH] KSES: Allow SVG presentation attributes in safe_style_css. Add SVG presentation attributes to the list of CSS properties allowed by `safecss_filter_attr()`, so inline SVG markup can be styled via the `style` attribute. This ports Gutenberg PR #79172 to Core. Props afercia, westonruter, wildworks. Fixes #65457. Built from https://develop.svn.wordpress.org/trunk@62530 git-svn-id: http://core.svn.wordpress.org/trunk@61811 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/kses.php | 66 +++++++++++++++++++++++++++++++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/wp-includes/kses.php b/wp-includes/kses.php index a45d1697ea..b6c24b77e2 100644 --- a/wp-includes/kses.php +++ b/wp-includes/kses.php @@ -2579,6 +2579,7 @@ function safecss_filter_attr( $css, $deprecated = '' ) { * Filters the list of allowed CSS attributes. * * @since 2.8.1 + * @since 7.1.0 Added support for SVG presentation attributes. * * @param string[] $attr Array of allowed CSS attributes. */ @@ -2737,6 +2738,71 @@ function safecss_filter_attr( $css, $deprecated = '' ) { 'aspect-ratio', 'container-type', + 'fill', + 'fill-opacity', + 'fill-rule', + + 'stroke', + 'stroke-dasharray', + 'stroke-dashoffset', + 'stroke-linecap', + 'stroke-linejoin', + 'stroke-miterlimit', + 'stroke-opacity', + 'stroke-width', + + 'color-interpolation', + 'color-interpolation-filters', + 'paint-order', + 'stop-color', + 'stop-opacity', + 'flood-color', + 'flood-opacity', + 'lighting-color', + + 'marker', + 'marker-end', + 'marker-mid', + 'marker-start', + + 'clip-path', + 'clip-rule', + 'mask', + 'mask-type', + + 'cx', + 'cy', + 'r', + 'rx', + 'ry', + 'x', + 'y', + 'd', + + 'alignment-baseline', + 'baseline-shift', + 'dominant-baseline', + 'glyph-orientation-horizontal', + 'glyph-orientation-vertical', + 'text-anchor', + 'unicode-bidi', + 'word-spacing', + + 'font-size-adjust', + 'font-stretch', + + 'color-rendering', + 'image-rendering', + 'shape-rendering', + 'text-rendering', + 'vector-effect', + + 'transform', + 'transform-origin', + + 'pointer-events', + 'visibility', + // Custom CSS properties. '--*', ) diff --git a/wp-includes/version.php b/wp-includes/version.php index 7ee62242f8..6431fe0475 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '7.1-alpha-62529'; +$wp_version = '7.1-alpha-62530'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.