Skip to content

Commit 66a9169

Browse files
committed
Don't split on commas
1 parent 2030226 commit 66a9169

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/wp-includes/class-wp-block-supports.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ function get_block_wrapper_attributes( $extra_attributes = array() ) {
193193
},
194194
'class' => static function ( $new_attribute, $extra_attribute ) {
195195
$classes = array_merge(
196-
wp_parse_list( $extra_attribute ),
197-
wp_parse_list( $new_attribute )
196+
preg_split( '/\s+/', $extra_attribute, -1, PREG_SPLIT_NO_EMPTY ),
197+
preg_split( '/\s+/', $new_attribute, -1, PREG_SPLIT_NO_EMPTY )
198198
);
199-
$classes = array_unique( array_filter( array_map( 'sanitize_html_class', $classes ) ) );
199+
$classes = array_unique( array_filter( $classes ) );
200200
return implode( ' ', $classes );
201201
},
202202
'id' => static function ( $new_attribute, $extra_attribute ) {

tests/phpunit/tests/blocks/supportedStyles.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -837,10 +837,10 @@ public function data_get_block_wrapper_attributes_merge_or_override() {
837837
),
838838
),
839839
'extra_attributes' => array(
840-
// Duplicate class names should be merged
841-
'class' => 'extra-class has-text-color',
840+
// Duplicate class names should be merged, and commas should be preserved.
841+
'class' => 'extra-class extra,class has-text-color',
842842
),
843-
'expected_attribute' => 'class="extra-class has-text-color wp-block-example"',
843+
'expected_attribute' => 'class="extra-class extra,class has-text-color wp-block-example"',
844844
),
845845
),
846846
'extra attributes override block-generated id' => array(

0 commit comments

Comments
 (0)