[wp-trac] [WordPress Trac] #34105: kses strips tags with hyphens in the name
WordPress Trac
noreply at wordpress.org
Thu Oct 1 04:30:35 UTC 2015
#34105: kses strips tags with hyphens in the name
--------------------------+-----------------------------
Reporter: batmoo | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
The W3C Custom Elements spec (http://www.w3.org/TR/custom-
elements/#concepts) allows you to use your own custom DOM elements/tags.
One of the main requirements is that the tag name "must contain a U+002D
HYPHEN-MINUS character".
However, kses does not currently factor in the hyphen and strips out tags,
even if they're set to be explicitly allowed:
{{{
$string = '<hyphenated-tag>Hello</hyphenated-tag>';
wp_kses( $string, array( 'hyphenated-tag' => array() ) );
// returns 'Hello' but should be '<hyphenated-tag>Hello</hyphenated-tag>'
}}}
This is because the regex for parsing the element name within kses only
allow alphanumerics. It would be nice if this was loosened to allow
hyphens in the tag name.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34105>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list