Skip to content

Commit 6b08132

Browse files
committed
KSES: Allow CSS anchor position properties.
Adds CSS anchoring properties to the `safecss_filter_attr()` allow list: * `anchor-name` * `anchor-scope` * `position-anchor` * `position-area` * `position-try` * `position-try-fallbacks` * `position-try-order` * `position-visibility` Props deepakprajapati, wildworks, adrianduffell, dannyreaktiv, im3dabasia1, westonruter. Fixes #64972. git-svn-id: https://develop.svn.wordpress.org/trunk@63910 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 98d2187 commit 6b08132

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎src/wp-includes/kses.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2639,6 +2639,7 @@ function kses_init() {
26392639
* @since 7.1.0 Extended gradient support to allow any single-level nested function.
26402640
* Added support for transform functions, `clip-path` basic shapes,
26412641
* and URLs in the SVG element reference properties.
2642+
* @since 7.2.0 Added support for CSS anchor positioning properties.
26422643
*
26432644
* @param string $css A string of CSS rules, decoded from an HTML `style` attribute.
26442645
* @param string $deprecated Not used.
@@ -2885,6 +2886,15 @@ function safecss_filter_attr( $css, $deprecated = '' ) {
28852886
'pointer-events',
28862887
'visibility',
28872888

2889+
'anchor-name',
2890+
'anchor-scope',
2891+
'position-anchor',
2892+
'position-area',
2893+
'position-try',
2894+
'position-try-fallbacks',
2895+
'position-try-order',
2896+
'position-visibility',
2897+
28882898
// Custom CSS properties.
28892899
'--*',
28902900
)

‎tests/phpunit/tests/kses.php‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,7 @@ public function test_wp_kses_attr_no_attributes_allowed_with_false() {
12251225
* @ticket 65457
12261226
* @ticket 64974
12271227
* @ticket 65832
1228+
* @ticket 64972
12281229
*
12291230
* @dataProvider data_safecss_filter_attr
12301231
*
@@ -1882,6 +1883,11 @@ public function data_safecss_filter_attr() {
18821883
'css' => 'clip-path: url(javascript:alert(1))',
18831884
'expected' => '',
18841885
),
1886+
// CSS anchor positioning properties introduced in 7.2.
1887+
array(
1888+
'css' => 'anchor-name: --tooltip;anchor-scope: all;position-anchor: --tooltip;position-area: top;position-try: flip-block;position-try-fallbacks: --fallback;position-try-order: most-height;position-visibility: anchors-visible',
1889+
'expected' => 'anchor-name: --tooltip;anchor-scope: all;position-anchor: --tooltip;position-area: top;position-try: flip-block;position-try-fallbacks: --fallback;position-try-order: most-height;position-visibility: anchors-visible',
1890+
),
18851891
);
18861892
}
18871893

0 commit comments

Comments
 (0)