Skip to content

Commit e3c2654

Browse files
committed
KSES: Add command and commandfor to the list of allowed attributes for buttons.
Developed in: WordPress#11483 Props pratiknawkar94, joedolson, westonruter, afercia. Fixes #64576. git-svn-id: https://develop.svn.wordpress.org/trunk@62531 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e904e28 commit e3c2654

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/wp-includes/kses.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@
109109
),
110110
'br' => array(),
111111
'button' => array(
112+
'command' => true,
113+
'commandfor' => true,
112114
'disabled' => true,
113115
'name' => true,
114116
'type' => true,

tests/phpunit/tests/kses.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,6 +1928,17 @@ public function test_wp_kses_main_tag_standard_attributes() {
19281928
$this->assertEqualHTML( $html, wp_kses_post( $html ) );
19291929
}
19301930

1931+
/**
1932+
* Test that Invoker Commands API attributes are preserved on buttons in post content.
1933+
*
1934+
* @ticket 64576
1935+
*/
1936+
public function test_wp_kses_button_invoker_command_attributes() {
1937+
$html = '<button type="button" commandfor="my-popover" command="toggle-popover">Toggle</button><div id="my-popover" popover>Content</div>';
1938+
1939+
$this->assertEqualHTML( $html, wp_kses_post( $html ) );
1940+
}
1941+
19311942
/**
19321943
* Test that object tags are allowed under limited circumstances.
19331944
*

0 commit comments

Comments
 (0)