<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[57316] trunk: HTML API: Add support for BR, EMBED, & other tags.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/57316">57316</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/57316","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>dmsnell</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-01-19 21:40:01 +0000 (Fri, 19 Jan 2024)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>HTML API: Add support for BR, EMBED, & other tags.
Adds support for the following HTML elements to the HTML Processor:
- AREA, BR, EMBED, KEYGEN, WBR
- Only the opening BR tag is supported, as the invalid closer `</br>`
involves more complicated rules, to be implemented later.
Previously, these elements were not supported and the HTML Processor
would bail when encountering them. With this patch it will proceed to
parse an HTML document when encountering those tags as long as other
normal conditions don't cause it to bail (such as complicated format
reconstruction rules).
Props jonsurrell, dmsnell
Fixes <a href="https://core.trac.wordpress.org/ticket/60283">#60283</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludeshtmlapiclasswphtmlprocessorphp">trunk/src/wp-includes/html-api/class-wp-html-processor.php</a></li>
<li><a href="#trunktestsphpunittestshtmlapiwpHtmlProcessorphp">trunk/tests/phpunit/tests/html-api/wpHtmlProcessor.php</a></li>
<li><a href="#trunktestsphpunittestshtmlapiwpHtmlProcessorBreadcrumbsphp">trunk/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php</a></li>
<li><a href="#trunktestsphpunittestshtmlapiwpHtmlProcessorSemanticRulesphp">trunk/tests/phpunit/tests/html-api/wpHtmlProcessorSemanticRules.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludeshtmlapiclasswphtmlprocessorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/html-api/class-wp-html-processor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/html-api/class-wp-html-processor.php 2024-01-19 20:52:06 UTC (rev 57315)
+++ trunk/src/wp-includes/html-api/class-wp-html-processor.php 2024-01-19 21:40:01 UTC (rev 57316)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -102,17 +102,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * - Containers: ADDRESS, BLOCKQUOTE, DETAILS, DIALOG, DIV, FOOTER, HEADER, MAIN, MENU, SPAN, SUMMARY.
</span><span class="cx" style="display: block; padding: 0 10px"> * - Custom elements: All custom elements are supported. :)
</span><span class="cx" style="display: block; padding: 0 10px"> * - Form elements: BUTTON, DATALIST, FIELDSET, LABEL, LEGEND, METER, PROGRESS, SEARCH.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * - Formatting elements: B, BIG, CODE, EM, FONT, I, SMALL, STRIKE, STRONG, TT, U.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * - Formatting elements: B, BIG, CODE, EM, FONT, I, SMALL, STRIKE, STRONG, TT, U, WBR.
</ins><span class="cx" style="display: block; padding: 0 10px"> * - Heading elements: H1, H2, H3, H4, H5, H6, HGROUP.
</span><span class="cx" style="display: block; padding: 0 10px"> * - Links: A.
</span><span class="cx" style="display: block; padding: 0 10px"> * - Lists: DD, DL, DT, LI, OL, LI.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * - Media elements: AUDIO, CANVAS, FIGCAPTION, FIGURE, IMG, MAP, PICTURE, VIDEO.
- * - Paragraph: P.
- * - Phrasing elements: ABBR, BDI, BDO, CITE, DATA, DEL, DFN, INS, MARK, OUTPUT, Q, SAMP, SUB, SUP, TIME, VAR.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * - Media elements: AUDIO, CANVAS, EMBED, FIGCAPTION, FIGURE, IMG, MAP, PICTURE, VIDEO.
+ * - Paragraph: BR, P.
+ * - Phrasing elements: AREA, ABBR, BDI, BDO, CITE, DATA, DEL, DFN, INS, MARK, OUTPUT, Q, SAMP, SUB, SUP, TIME, VAR.
</ins><span class="cx" style="display: block; padding: 0 10px"> * - Sectioning elements: ARTICLE, ASIDE, HR, NAV, SECTION.
</span><span class="cx" style="display: block; padding: 0 10px"> * - Templating elements: SLOT.
</span><span class="cx" style="display: block; padding: 0 10px"> * - Text decoration: RUBY.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * - Deprecated elements: ACRONYM, BLINK, CENTER, DIR, ISINDEX, MULTICOL, NEXTID, SPACER.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * - Deprecated elements: ACRONYM, BLINK, CENTER, DIR, ISINDEX, KEYGEN, MULTICOL, NEXTID, SPACER.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * ### Supported markup
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -935,11 +935,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * > An end tag whose tag name is "br"
+ * > Parse error. Drop the attributes from the token, and act as described in the next
+ * > entry; i.e. act as if this was a "br" start tag token with no attributes, rather
+ * > than the end tag token that it actually is.
+ */
+ case '-BR':
+ $this->last_error = self::ERROR_UNSUPPORTED;
+ throw new WP_HTML_Unsupported_Exception( 'Closing BR tags require unimplemented special handling.' );
+
+ /*
</ins><span class="cx" style="display: block; padding: 0 10px"> * > A start tag whose tag name is one of: "area", "br", "embed", "img", "keygen", "wbr"
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case '+AREA':
+ case '+BR':
+ case '+EMBED':
</ins><span class="cx" style="display: block; padding: 0 10px"> case '+IMG':
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case '+KEYGEN':
+ case '+WBR':
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->reconstruct_active_formatting_elements();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->insert_html_element( $this->state->current_token );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->state->frameset_ok = false;
</ins><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -977,13 +993,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> case 'BASEFONT':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'BGSOUND':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'BODY':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'BR':
</del><span class="cx" style="display: block; padding: 0 10px"> case 'CAPTION':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'COL':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'COLGROUP':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'DD':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'DT':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'EMBED':
</del><span class="cx" style="display: block; padding: 0 10px"> case 'FORM':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'FRAME':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'FRAMESET':
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -991,7 +1005,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> case 'HTML':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'IFRAME':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'INPUT':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'KEYGEN':
</del><span class="cx" style="display: block; padding: 0 10px"> case 'LI':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'LINK':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'LISTING':
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1031,7 +1044,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> case 'TR':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'TRACK':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'UL':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'WBR':
</del><span class="cx" style="display: block; padding: 0 10px"> case 'XMP':
</span><span class="cx" style="display: block; padding: 0 10px"> $this->last_error = self::ERROR_UNSUPPORTED;
</span><span class="cx" style="display: block; padding: 0 10px"> throw new WP_HTML_Unsupported_Exception( "Cannot process {$tag_name} element." );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1692,6 +1704,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'IMG' === $tag_name ||
</span><span class="cx" style="display: block; padding: 0 10px"> 'INPUT' === $tag_name ||
</span><span class="cx" style="display: block; padding: 0 10px"> 'LINK' === $tag_name ||
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'KEYGEN' === $tag_name || // Obsolete but still treated as void.
</ins><span class="cx" style="display: block; padding: 0 10px"> 'META' === $tag_name ||
</span><span class="cx" style="display: block; padding: 0 10px"> 'SOURCE' === $tag_name ||
</span><span class="cx" style="display: block; padding: 0 10px"> 'TRACK' === $tag_name ||
</span></span></pre></div>
<a id="trunktestsphpunittestshtmlapiwpHtmlProcessorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/html-api/wpHtmlProcessor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/html-api/wpHtmlProcessor.php 2024-01-19 20:52:06 UTC (rev 57315)
+++ trunk/tests/phpunit/tests/html-api/wpHtmlProcessor.php 2024-01-19 21:40:01 UTC (rev 57316)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -133,6 +133,86 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Ensure non-nesting tags do not nest.
+ *
+ * @ticket 60283
+ *
+ * @covers WP_HTML_Processor::step_in_body
+ * @covers WP_HTML_Processor::is_void
+ *
+ * @dataProvider data_void_tags
+ *
+ * @param string $tag_name Name of void tag under test.
+ */
+ public function test_cannot_nest_void_tags( $tag_name ) {
+ $processor = WP_HTML_Processor::create_fragment( "<{$tag_name}><div>" );
+
+ /*
+ * This HTML represents the same as the following HTML,
+ * assuming that it were provided `<img>` as the tag:
+ *
+ * <html>
+ * <body>
+ * <img>
+ * <div></div>
+ * </body>
+ * </html>
+ */
+
+ $found_tag = $processor->next_tag();
+
+ if ( WP_HTML_Processor::ERROR_UNSUPPORTED === $processor->get_last_error() ) {
+ $this->markTestSkipped( "Tag {$tag_name} is not supported." );
+ }
+
+ $this->assertTrue(
+ $found_tag,
+ "Could not find first {$tag_name}."
+ );
+
+ $this->assertSame(
+ array( 'HTML', 'BODY', $tag_name ),
+ $processor->get_breadcrumbs(),
+ 'Found incorrect nesting of first element.'
+ );
+
+ $this->assertTrue(
+ $processor->next_tag(),
+ 'Should have found the DIV as the second tag.'
+ );
+
+ $this->assertSame(
+ array( 'HTML', 'BODY', 'DIV' ),
+ $processor->get_breadcrumbs(),
+ "DIV should have been a sibling of the {$tag_name}."
+ );
+ }
+
+ /**
+ * Data provider.
+ *
+ * @return array[]
+ */
+ public function data_void_tags() {
+ return array(
+ 'AREA' => array( 'AREA' ),
+ 'BASE' => array( 'BASE' ),
+ 'BR' => array( 'BR' ),
+ 'COL' => array( 'COL' ),
+ 'EMBED' => array( 'EMBED' ),
+ 'HR' => array( 'HR' ),
+ 'IMG' => array( 'IMG' ),
+ 'INPUT' => array( 'INPUT' ),
+ 'KEYGEN' => array( 'KEYGEN' ),
+ 'LINK' => array( 'LINK' ),
+ 'META' => array( 'META' ),
+ 'SOURCE' => array( 'SOURCE' ),
+ 'TRACK' => array( 'TRACK' ),
+ 'WBR' => array( 'WBR' ),
+ );
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Ensures that special handling of unsupported tags is cleaned up
</span><span class="cx" style="display: block; padding: 0 10px"> * as handling is implemented. Otherwise there's risk of leaving special
</span><span class="cx" style="display: block; padding: 0 10px"> * handling (that is never reached) when tag handling is implemented.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -159,16 +239,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public function data_unsupported_special_in_body_tags() {
</span><span class="cx" style="display: block; padding: 0 10px"> return array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'APPLET' => array( 'APPLET' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'AREA' => array( 'AREA' ),
</del><span class="cx" style="display: block; padding: 0 10px"> 'BASE' => array( 'BASE' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'BASEFONT' => array( 'BASEFONT' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'BGSOUND' => array( 'BGSOUND' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'BODY' => array( 'BODY' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'BR' => array( 'BR' ),
</del><span class="cx" style="display: block; padding: 0 10px"> 'CAPTION' => array( 'CAPTION' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'COL' => array( 'COL' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'COLGROUP' => array( 'COLGROUP' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'EMBED' => array( 'EMBED' ),
</del><span class="cx" style="display: block; padding: 0 10px"> 'FORM' => array( 'FORM' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'FRAME' => array( 'FRAME' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'FRAMESET' => array( 'FRAMESET' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -176,7 +253,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'HTML' => array( 'HTML' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'IFRAME' => array( 'IFRAME' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'INPUT' => array( 'INPUT' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'KEYGEN' => array( 'KEYGEN' ),
</del><span class="cx" style="display: block; padding: 0 10px"> 'LINK' => array( 'LINK' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'LISTING' => array( 'LISTING' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'MARQUEE' => array( 'MARQUEE' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -213,7 +289,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'TITLE' => array( 'TITLE' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'TR' => array( 'TR' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'TRACK' => array( 'TRACK' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'WBR' => array( 'WBR' ),
</del><span class="cx" style="display: block; padding: 0 10px"> 'XMP' => array( 'XMP' ),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunittestshtmlapiwpHtmlProcessorBreadcrumbsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php 2024-01-19 20:52:06 UTC (rev 57315)
+++ trunk/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php 2024-01-19 21:40:01 UTC (rev 57316)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -162,15 +162,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public function data_unsupported_elements() {
</span><span class="cx" style="display: block; padding: 0 10px"> $unsupported_elements = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'APPLET', // Deprecated.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'AREA',
</del><span class="cx" style="display: block; padding: 0 10px"> 'BASE',
</span><span class="cx" style="display: block; padding: 0 10px"> 'BGSOUND', // Deprecated; self-closing if self-closing flag provided, otherwise normal.
</span><span class="cx" style="display: block; padding: 0 10px"> 'BODY',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'BR',
</del><span class="cx" style="display: block; padding: 0 10px"> 'CAPTION',
</span><span class="cx" style="display: block; padding: 0 10px"> 'COL',
</span><span class="cx" style="display: block; padding: 0 10px"> 'COLGROUP',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'EMBED',
</del><span class="cx" style="display: block; padding: 0 10px"> 'FORM',
</span><span class="cx" style="display: block; padding: 0 10px"> 'FRAME',
</span><span class="cx" style="display: block; padding: 0 10px"> 'FRAMESET',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -178,7 +175,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'HTML',
</span><span class="cx" style="display: block; padding: 0 10px"> 'IFRAME',
</span><span class="cx" style="display: block; padding: 0 10px"> 'INPUT',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'KEYGEN', // Deprecated; void.
</del><span class="cx" style="display: block; padding: 0 10px"> 'LINK',
</span><span class="cx" style="display: block; padding: 0 10px"> 'LISTING', // Deprecated, use PRE instead.
</span><span class="cx" style="display: block; padding: 0 10px"> 'MARQUEE', // Deprecated.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -213,7 +209,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'TITLE',
</span><span class="cx" style="display: block; padding: 0 10px"> 'TR',
</span><span class="cx" style="display: block; padding: 0 10px"> 'TRACK',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'WBR',
</del><span class="cx" style="display: block; padding: 0 10px"> 'XMP', // Deprecated, use PRE instead.
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunktestsphpunittestshtmlapiwpHtmlProcessorSemanticRulesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/html-api/wpHtmlProcessorSemanticRules.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/html-api/wpHtmlProcessorSemanticRules.php 2024-01-19 20:52:06 UTC (rev 57315)
+++ trunk/tests/phpunit/tests/html-api/wpHtmlProcessorSemanticRules.php 2024-01-19 21:40:01 UTC (rev 57316)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -392,4 +392,29 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertSame( 'DIV', $p->get_tag(), "Expected to find DIV element, but found {$p->get_tag()} instead." );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertSame( array( 'HTML', 'BODY', 'DIV', 'DIV' ), $p->get_breadcrumbs(), 'Failed to produce expected DOM nesting: SPAN should be closed and DIV should be its sibling.' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Ensures that support isn't accidentally partially added for the closing BR tag `</br>`.
+ *
+ * This tag closer has special rules and support shouldn't be added without implementing full support.
+ *
+ * > An end tag whose tag name is "br"
+ * > Parse error. Drop the attributes from the token, and act as described in the next entry;
+ * > i.e. act as if this was a "br" start tag token with no attributes, rather than the end
+ * > tag token that it actually is.
+ *
+ * When this handling is implemented, this test should be removed. It's not incorporated
+ * into the existing unsupported tag behavior test because the opening tag is supported;
+ * only the closing tag isn't.
+ *
+ * @covers WP_HTML_Processor::step_in_body
+ *
+ * @ticket 60283
+ */
+ public function test_br_end_tag_unsupported() {
+ $p = WP_HTML_Processor::create_fragment( '</br>' );
+
+ $this->assertFalse( $p->next_tag(), 'Found a BR tag that should not be handled.' );
+ $this->assertSame( WP_HTML_Processor::ERROR_UNSUPPORTED, $p->get_last_error() );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>