Make WordPress Core


Ignore:
Timestamp:
09/08/2022 03:04:39 PM (3 years ago)
Author:
SergeyBiryukov
Message:

KSES: Allow more layout-related CSS properties.

Adds support for the following CSS properties considered safe for inline CSS:

  • flex-wrap
  • gap
  • column-gap
  • row-gap

Extends support for margin and padding to include logical properties:

  • margin-block-start
  • margin-block-end
  • margin-inline-start
  • margin-inline-end
  • padding-block-start
  • padding-block-end
  • padding-inline-start
  • padding-inline-end

Follow-up to [46235].

Props andrewserong, peterwilsoncc, ramonopoly, bernhard-reiter.
Fixes #56122.

File:
1 edited

Legend:

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

    r54100 r54102  
    937937     * @ticket 48376
    938938     * @ticket 55966
     939     * @ticket 56122
    939940     * @dataProvider data_test_safecss_filter_attr
    940941     *
     
    10351036            // `flex` and related attributes introduced in 5.3.
    10361037            array(
    1037                 'css'      => 'flex: 0 1 auto;flex-basis: 75%;flex-direction: row-reverse;flex-flow: row-reverse nowrap;flex-grow: 2;flex-shrink: 1',
    1038                 'expected' => 'flex: 0 1 auto;flex-basis: 75%;flex-direction: row-reverse;flex-flow: row-reverse nowrap;flex-grow: 2;flex-shrink: 1',
     1038                'css'      => 'flex: 0 1 auto;flex-basis: 75%;flex-direction: row-reverse;flex-flow: row-reverse nowrap;flex-grow: 2;flex-shrink: 1;flex-wrap: nowrap',
     1039                'expected' => 'flex: 0 1 auto;flex-basis: 75%;flex-direction: row-reverse;flex-flow: row-reverse nowrap;flex-grow: 2;flex-shrink: 1;flex-wrap: nowrap',
    10391040            ),
    10401041            // `grid` and related attributes introduced in 5.3.
     
    12361237                'css'      => 'width: (3em + (10px * 2))',
    12371238                'expected' => '',
     1239            ),
     1240            // Gap introduced in 6.1.
     1241            array(
     1242                'css'      => 'gap: 10px;column-gap: 5px;row-gap: 20px',
     1243                'expected' => 'gap: 10px;column-gap: 5px;row-gap: 20px',
     1244            ),
     1245            // Margin and padding logical properties introduced in 6.1.
     1246            array(
     1247                'css'      => 'margin-block-start: 1px;margin-block-end: 2px;margin-inline-start: 3px;margin-inline-end: 4px;padding-block-start: 1px;padding-block-end: 2px;padding-inline-start: 3px;padding-inline-end: 4px',
     1248                'expected' => 'margin-block-start: 1px;margin-block-end: 2px;margin-inline-start: 3px;margin-inline-end: 4px;padding-block-start: 1px;padding-block-end: 2px;padding-inline-start: 3px;padding-inline-end: 4px',
    12381249            ),
    12391250        );
Note: See TracChangeset for help on using the changeset viewer.