[wp-trac] [WordPress Trac] #61501: KSES Allow more custom data attributes to align with browsers
WordPress Trac
noreply at wordpress.org
Tue Oct 22 11:12:56 UTC 2024
#61501: KSES Allow more custom data attributes to align with browsers
-------------------------+------------------------------
Reporter: jonsurrell | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------+------------------------------
Comment (by jonsurrell):
#62131 and [https://github.com/WordPress/gutenberg/pull/65803 Gutenberg PR
65803] demonstrate some motivation to allow more data attributes.
[https://developer.wordpress.org/block-editor/reference-guides
/interactivity-api/api-reference/#wp-class The Interactivity API has a
"class" directive like this:]
{{{
<div data-wp-class--highlight="state.highlight"></div>
}}}
This adds or removes the "highlight" class on the element depending on the
value of the Interactivity API store's `state.highlight` value.
Tailwind is a popular CSS framework that can make use of the class
directive. However, [https://tailwindcss.com/docs/top-right-bottom-left
#arbitrary-values some of the class names] that would need to appear as
class directives are not allowed by kses:
{{{#!php
<?php
echo wp_kses( '<div data-wp-class--top-[3px]="state">', 'post' );
// <div>
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61501#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list