KSES: Add flex and related long form properties to safe CSS.

Allow `flex`, `flex-grow`, `flex-shrink` and `flex-basis` to be used in inline CSS. As of WordPress 5.3 the block editor is expected to use `flex-basis` inline to set the width in the column block.

Props aduth.
Fixes #47281.
See #37248.



git-svn-id: https://develop.svn.wordpress.org/trunk@45363 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Wilson 2019-05-18 04:33:27 +00:00
parent e353c2841a
commit b9e6f18350
2 changed files with 11 additions and 0 deletions

View File

@ -2063,6 +2063,7 @@ function safecss_filter_attr( $css, $deprecated = '' ) {
* @since 5.0.0 Added support for `background-image`.
* @since 5.1.0 Added support for `text-transform`.
* @since 5.2.0 Added support for `background-position` and `grid-template-columns`
* @since 5.3.0 Added support for `flex`, `flex-grow`, `flex-shrink`, and `flex-basis`.
*
* @param string[] $attr Array of allowed CSS attributes.
*/
@ -2133,6 +2134,11 @@ function safecss_filter_attr( $css, $deprecated = '' ) {
'padding-left',
'padding-top',
'flex',
'flex-grow',
'flex-shrink',
'flex-basis',
'clear',
'cursor',
'direction',

View File

@ -830,6 +830,11 @@ EOF;
'css' => 'background: green url("foo.jpg") no-repeat fixed center',
'expected' => 'background: green url("foo.jpg") no-repeat fixed center',
),
// `flex` and related attributes introduced in 5.3.
array(
'css' => 'flex: 0 1 auto;flex-basis: 75%;flex-shrink: 0;flex-grow: 1',
'expected' => 'flex: 0 1 auto;flex-basis: 75%;flex-shrink: 0;flex-grow: 1',
),
);
}