Make WordPress Core

Changeset 60671


Ignore:
Timestamp:
08/26/2025 09:06:43 PM (4 months ago)
Author:
TimothyBlynJacobs
Message:

Formatting: Add 'white-space' as an allowed KSES CSS attribute.

The 'white-space' attribute is safe, has wide browser support, and is useful.

Props sukhendu2002, mukesh27, whyisjake..
Fixes #51707.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/kses.php

    r60616 r60671  
    24192419 * @since 6.5.0 Added support for `background-repeat`.
    24202420 * @since 6.6.0 Added support for `grid-column`, `grid-row`, and `container-type`.
     2421 * @since 6.9.0 Added support for `white-space`.
    24212422 *
    24222423 * @param string $css        A string of CSS rules.
     
    25112512            'text-indent',
    25122513            'text-transform',
     2514            'white-space',
    25132515
    25142516            'height',
  • trunk/tests/phpunit/tests/kses.php

    r60616 r60671  
    11811181                'expected' => 'object-fit: cover',
    11821182            ),
     1183            // `white-space` introduced in 6.9.0.
     1184            array(
     1185                'css'      => 'white-space: nowrap',
     1186                'expected' => 'white-space: nowrap',
     1187            ),
     1188            array(
     1189                'css'      => 'white-space: pre',
     1190                'expected' => 'white-space: pre',
     1191            ),
     1192            array(
     1193                'css'      => 'white-space: pre-wrap',
     1194                'expected' => 'white-space: pre-wrap',
     1195            ),
     1196            array(
     1197                'css'      => 'white-space: pre-line',
     1198                'expected' => 'white-space: pre-line',
     1199            ),
    11831200            // Expressions are not allowed.
    11841201            array(
Note: See TracChangeset for help on using the changeset viewer.