Make WordPress Core

Changeset 62531


Ignore:
Timestamp:
06/19/2026 11:02:30 AM (19 hours ago)
Author:
afercia
Message:

KSES: Add command and commandfor to the list of allowed attributes for buttons.

Developed in: https://github.com/WordPress/wordpress-develop/pull/11483

Props pratiknawkar94, joedolson, westonruter, afercia.

Fixes #64576.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/kses.php

    r62530 r62531  
    110110        'br'         => array(),
    111111        'button'     => array(
     112            'command'             => true,
     113            'commandfor'          => true,
    112114            'disabled'            => true,
    113115            'name'                => true,
  • trunk/tests/phpunit/tests/kses.php

    r62530 r62531  
    19301930
    19311931    /**
     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
     1942    /**
    19321943     * Test that object tags are allowed under limited circumstances.
    19331944     *
Note: See TracChangeset for help on using the changeset viewer.