Make WordPress Core


Ignore:
Timestamp:
06/19/2026 06:41:13 AM (22 hours ago)
Author:
wildworks
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/kses.php

    r62433 r62530  
    10011001     * @ticket 60132
    10021002     * @ticket 64414
     1003     * @ticket 65457
    10031004     *
    10041005     * @dataProvider data_safecss_filter_attr
     
    14731474                'css'      => 'display: grid',
    14741475                'expected' => 'display: grid',
     1476            ),
     1477            // SVG presentation attributes introduced in 7.1.0.
     1478            array(
     1479                'css'      => 'fill: none',
     1480                'expected' => 'fill: none',
     1481            ),
     1482            array(
     1483                'css'      => 'fill-rule: evenodd',
     1484                'expected' => 'fill-rule: evenodd',
     1485            ),
     1486            array(
     1487                'css'      => 'stroke: red',
     1488                'expected' => 'stroke: red',
     1489            ),
     1490            array(
     1491                'css'      => 'stroke-width: 2',
     1492                'expected' => 'stroke-width: 2',
     1493            ),
     1494            array(
     1495                'css'      => 'stroke-linecap: round',
     1496                'expected' => 'stroke-linecap: round',
     1497            ),
     1498            array(
     1499                'css'      => 'paint-order: stroke',
     1500                'expected' => 'paint-order: stroke',
     1501            ),
     1502            array(
     1503                'css'      => 'vector-effect: non-scaling-stroke',
     1504                'expected' => 'vector-effect: non-scaling-stroke',
     1505            ),
     1506            array(
     1507                'css'      => 'clip-rule: evenodd',
     1508                'expected' => 'clip-rule: evenodd',
     1509            ),
     1510            array(
     1511                'css'      => 'text-anchor: middle',
     1512                'expected' => 'text-anchor: middle',
    14751513            ),
    14761514        );
Note: See TracChangeset for help on using the changeset viewer.