Skip to content

Commit

Permalink
Formatting: Add 'main' tag to kses
Browse files Browse the repository at this point in the history
`main` is a valid HTML element that is especially valuable for KSES to support in light of full site editing.

Related: WordPress/gutenberg#28576 for the addition of `main` to the group block.

Fixes #53156.
Props glendaviesnz.



git-svn-id: https://develop.svn.wordpress.org/trunk@50987 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
jorbin committed May 25, 2021
1 parent a66c961 commit 25454bc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/wp-includes/kses.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@
'align' => true,
'value' => true,
),
'main' => array(
'align' => true,
'dir' => true,
'lang' => true,
'xml:lang' => true,
),
'map' => array(
'name' => true,
),
Expand Down
18 changes: 18 additions & 0 deletions tests/phpunit/tests/kses.php
Original file line number Diff line number Diff line change
Expand Up @@ -1478,4 +1478,22 @@ function test_wp_kses_img_tag_standard_attributes() {

$this->assertSame( $html, wp_kses_post( $html ) );
}

/**
* Test filtering a standard main tag.
*
* @ticket 53156
*/
function test_wp_kses_main_tag_standard_attributes() {
$test = array(
'<main',
'class="wp-group-block"',
'style="padding:10px"',
'/>',
);

$html = implode( ' ', $test );

$this->assertSame( $html, wp_kses_post( $html ) );
}
}

0 comments on commit 25454bc

Please sign in to comment.