<!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>[56790] trunk: HTML API: Rename `WP_HTML_Processor::createFragment()` to follow WPCS.</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/56790">56790</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/56790","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-10-05 22:40:48 +0000 (Thu, 05 Oct 2023)</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: Rename `WP_HTML_Processor::createFragment()` to follow WPCS.

`WP_HTML_Processor::create_fragment()` is the correct method name as per the WordPress PHP coding standards.

Follow-up to <a href="https://core.trac.wordpress.org/changeset/56274">[56274]</a>.

Props dmsnell, jrf, hellofromTonya, SergeyBiryukov.
Fixes <a href="https://core.trac.wordpress.org/ticket/59547">#59547</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>
<li><a href="#trunktestsphpunittestshtmlapiwpHtmlSupportRequiredHtmlProcessorphp">trunk/tests/phpunit/tests/html-api/wpHtmlSupportRequiredHtmlProcessor.php</a></li>
<li><a href="#trunktestsphpunittestshtmlapiwpHtmlSupportRequiredOpenElementsphp">trunk/tests/phpunit/tests/html-api/wpHtmlSupportRequiredOpenElements.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        2023-10-05 17:13:09 UTC (rev 56789)
+++ trunk/src/wp-includes/html-api/class-wp-html-processor.php  2023-10-05 22:40:48 UTC (rev 56790)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -39,7 +39,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * Example:
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *     $processor = WP_HTML_Processor::createFragment( $html );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *     $processor = WP_HTML_Processor::create_fragment( $html );
</ins><span class="cx" style="display: block; padding: 0 10px">  *     if ( $processor->next_tag( array( 'breadcrumbs' => array( 'DIV', 'FIGURE', 'IMG' ) ) ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">  *         $processor->add_class( 'responsive-image' );
</span><span class="cx" style="display: block; padding: 0 10px">  *     }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -58,7 +58,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * Since all elements find themselves inside a full HTML document
</span><span class="cx" style="display: block; padding: 0 10px">  * when parsed, the return value from `get_breadcrumbs()` will always
</span><span class="cx" style="display: block; padding: 0 10px">  * contain any implicit outermost elements. For example, when parsing
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * with `createFragment()` in the `BODY` context (the default), any
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * with `create_fragment()` in the `BODY` context (the default), any
</ins><span class="cx" style="display: block; padding: 0 10px">  * tag in the given HTML document will contain `array( 'HTML', 'BODY', … )`
</span><span class="cx" style="display: block; padding: 0 10px">  * in its breadcrumbs.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -239,7 +239,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $encoding Text encoding of the document; must be default of 'UTF-8'.
</span><span class="cx" style="display: block; padding: 0 10px">         * @return WP_HTML_Processor|null The created processor if successful, otherwise null.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        public static function createFragment( $html, $context = '<body>', $encoding = 'UTF-8' ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function create_fragment( $html, $context = '<body>', $encoding = 'UTF-8' ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( '<body>' !== $context || 'UTF-8' !== $encoding ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        return null;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -280,7 +280,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 6.4.0
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @see WP_HTML_Processor::createFragment()
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @see WP_HTML_Processor::create_fragment()
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string      $html                                  HTML to process.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string|null $use_the_static_create_methods_instead This constructor should not be called manually.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -292,9 +292,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        _doing_it_wrong(
</span><span class="cx" style="display: block; padding: 0 10px">                                __METHOD__,
</span><span class="cx" style="display: block; padding: 0 10px">                                sprintf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        /* translators: %s: WP_HTML_Processor::createFragment. */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 /* translators: %s: WP_HTML_Processor::create_fragment(). */
</ins><span class="cx" style="display: block; padding: 0 10px">                                         __( 'Call %s to create an HTML Processor instead of calling the constructor directly.' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        '<code>WP_HTML_Processor::createFragment</code>'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 '<code>WP_HTML_Processor::create_fragment()</code>'
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ),
</span><span class="cx" style="display: block; padding: 0 10px">                                '6.4.0'
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -324,7 +324,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * Example
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         *     $processor = WP_HTML_Processor::createFragment( '<template><strong><button><em><p><em>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  *     $processor = WP_HTML_Processor::create_fragment( '<template><strong><button><em><p><em>' );
</ins><span class="cx" style="display: block; padding: 0 10px">          *     false === $processor->next_tag();
</span><span class="cx" style="display: block; padding: 0 10px">         *     WP_HTML_Processor::ERROR_UNSUPPORTED === $processor->get_last_error();
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -428,7 +428,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * Example:
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         *     $processor = WP_HTML_Processor::createFragment( '<div><span><figure><img></figure></span></div>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  *     $processor = WP_HTML_Processor::create_fragment( '<div><span><figure><img></figure></span></div>' );
</ins><span class="cx" style="display: block; padding: 0 10px">          *     $processor->next_tag( 'img' );
</span><span class="cx" style="display: block; padding: 0 10px">         *     true  === $processor->matches_breadcrumbs( array( 'figure', 'img' ) );
</span><span class="cx" style="display: block; padding: 0 10px">         *     true  === $processor->matches_breadcrumbs( array( 'span', 'figure', 'img' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -557,7 +557,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * Example
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         *     $processor = WP_HTML_Processor::createFragment( '<p><strong><em><img></em></strong></p>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  *     $processor = WP_HTML_Processor::create_fragment( '<p><strong><em><img></em></strong></p>' );
</ins><span class="cx" style="display: block; padding: 0 10px">          *     $processor->next_tag( 'IMG' );
</span><span class="cx" style="display: block; padding: 0 10px">         *     $processor->get_breadcrumbs() === array( 'HTML', 'BODY', 'P', 'STRONG', 'EM', 'IMG' );
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1439,5 +1439,5 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @access private
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        const CONSTRUCTOR_UNLOCK_CODE = 'Use WP_HTML_Processor::createFragment instead of calling the class constructor directly.';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const CONSTRUCTOR_UNLOCK_CODE = 'Use WP_HTML_Processor::create_fragment() instead of calling the class constructor directly.';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</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    2023-10-05 17:13:09 UTC (rev 56789)
+++ trunk/tests/phpunit/tests/html-api/wpHtmlProcessor.php      2023-10-05 22:40:48 UTC (rev 56790)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -52,7 +52,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers WP_HTML_Processor::get_tag
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_get_tag_is_null_once_document_is_finished() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( '<div class="test">Test</div>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( '<div class="test">Test</div>' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $p->next_tag();
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( 'DIV', $p->get_tag() );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -69,7 +69,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers WP_HTML_Processor::next_tag
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_stops_processing_after_unsupported_elements() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( '<p><x-not-supported></p><p></p>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( '<p><x-not-supported></p><p></p>' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $p->next_tag( 'P' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertFalse( $p->next_tag(), 'Stepped into a tag after encountering X-NOT-SUPPORTED element when it should have aborted.' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertNull( $p->get_tag(), "Should have aborted processing, but still reported tag {$p->get_tag()} after properly failing to step into tag." );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -95,7 +95,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws WP_HTML_Unsupported_Exception
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_clear_to_navigate_after_seeking() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( '<div one><strong></strong></div><p><strong two></strong></p>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( '<div one><strong></strong></div><p><strong two></strong></p>' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                while ( $p->next_tag() ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        // Create a bookmark before entering a stack of elements and formatting elements.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -144,7 +144,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers WP_HTML_Processor::reconstruct_active_formatting_elements
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_fails_to_reconstruct_formatting_elements() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( '<p><em>One<p><em>Two<p><em>Three<p><em>Four' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( '<p><em>One<p><em>Two<p><em>Three<p><em>Four' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertTrue( $p->next_tag( 'EM' ), 'Could not find first EM.' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertFalse( $p->next_tag( 'EM' ), 'Should have aborted before finding second EM as it required reconstructing the first EM.' );
</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 2023-10-05 17:13:09 UTC (rev 56789)
+++ trunk/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php   2023-10-05 22:40:48 UTC (rev 56790)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -23,7 +23,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $tag_name Name of first tag in HTML (because HTML treats IMAGE as IMG this may not match the HTML).
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_navigates_into_normative_html_for_supported_elements( $html, $tag_name ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( $html );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( $html );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertTrue( $p->step(), "Failed to step into supported {$tag_name} element." );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( $tag_name, $p->get_tag(), "Misread {$tag_name} as a {$p->get_tag()} element." );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -85,7 +85,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $html HTML string containing unsupported elements.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_fails_when_encountering_unsupported_tag( $html ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( $html );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( $html );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertFalse( $p->step(), "Should not have stepped into unsupported {$p->get_tag()} element." );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -236,7 +236,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $html HTML containing unsupported markup.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_fails_when_encountering_unsupported_markup( $html, $description ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( $html );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( $html );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                while ( $p->step() && null === $p->get_attribute( 'supported' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        continue;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -277,7 +277,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @param int    $n           How many breadcrumb matches to scan through in order to find "target" element.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_finds_correct_tag_given_breadcrumbs( $html, $breadcrumbs, $n ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( $html );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( $html );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $p->next_tag(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -303,7 +303,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @return void
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_reports_correct_breadcrumbs_for_html( $html, $breadcrumbs, $ignored_n ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( $html );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( $html );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                while ( $p->next_tag() && null === $p->get_attribute( 'target' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        continue;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -362,7 +362,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @param bool     $should_match          Whether the target node should match the breadcrumbs.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_reports_if_tag_matches_breadcrumbs_of_various_specificity( $html_with_target_node, $breadcrumbs, $should_match ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $processor = WP_HTML_Processor::createFragment( $html_with_target_node );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $processor = WP_HTML_Processor::create_fragment( $html_with_target_node );
</ins><span class="cx" style="display: block; padding: 0 10px">                 while ( $processor->next_tag() && null === $processor->get_attribute( 'target' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        continue;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -420,7 +420,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers WP_HTML_Processor::set_attribute
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_can_modify_attributes_after_finding_tag() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( '<div><figure><img><figcaption>test</figcaption></figure>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( '<div><figure><img><figcaption>test</figcaption></figure>' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertTrue( $p->next_tag( array( 'breadcrumbs' => array( 'figcaption' ) ) ), 'Unable to find given tag.' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -438,7 +438,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers WP_HTML_Processor::next_tag
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_can_query_an_element_by_tag_name() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( '<div><DIV><strong><img></strong></DIV>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( '<div><DIV><strong><img></strong></DIV>' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $p->next_tag( 'IMG' );
</span><span class="cx" style="display: block; padding: 0 10px">                $p->set_attribute( 'loading', 'lazy' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -455,7 +455,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers WP_HTML_Processor::seek
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_can_seek_back_and_forth() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( '<div><p one><div><p><div two><p><div><p><div><p three>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( '<div><p one><div><p><div two><p><div><p><div><p three>' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Find first tag of interest.
</span><span class="cx" style="display: block; padding: 0 10px">                while ( $p->next_tag() && null === $p->get_attribute( 'one' ) ) {
</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       2023-10-05 17:13:09 UTC (rev 56789)
+++ trunk/tests/phpunit/tests/html-api/wpHtmlProcessorSemanticRules.php 2023-10-05 22:40:48 UTC (rev 56790)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -27,7 +27,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws Exception
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_in_body_skips_unexpected_button_closer() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( '<div>Test</button></div>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( '<div>Test</button></div>' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $p->step();
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertEquals( 'DIV', $p->get_tag(), 'Did not stop at initial DIV tag.' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -52,7 +52,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws WP_HTML_Unsupported_Exception
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_in_body_button_with_no_button_in_scope() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( '<div><p>Click the button <button one>here</button>!</p></div><button two>not here</button>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( '<div><p>Click the button <button one>here</button>!</p></div><button two>not here</button>' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertTrue( $p->next_tag( 'BUTTON' ), 'Could not find expected first button.' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertTrue( $p->get_attribute( 'one' ), 'Failed to match expected attribute on first button.' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -79,7 +79,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws WP_HTML_Unsupported_Exception
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_in_body_button_with_button_in_scope_as_parent() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( '<div><p>Click the button <button one>almost<button two>here</button>!</p></div><button three>not here</button>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( '<div><p>Click the button <button one>almost<button two>here</button>!</p></div><button three>not here</button>' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertTrue( $p->next_tag( 'BUTTON' ), 'Could not find expected first button.' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertTrue( $p->get_attribute( 'one' ), 'Failed to match expected attribute on first button.' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -114,7 +114,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws WP_HTML_Unsupported_Exception
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_in_body_button_with_button_in_scope_as_ancestor() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( '<div><button one><p>Click the button <span><button two>here</button>!</span></p></div><button three>not here</button>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( '<div><button one><p>Click the button <span><button two>here</button>!</span></p></div><button three>not here</button>' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // This button finds itself normally nesting inside the DIV.
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertTrue( $p->next_tag( 'BUTTON' ), 'Could not find expected first button.' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -149,7 +149,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers WP_HTML_Processor::step_in_body
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_in_body_any_other_end_tag_with_unclosed_special_element() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( '<div><span><p></span><div>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( '<div><span><p></span><div>' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $p->next_tag( 'P' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( 'P', $p->get_tag(), "Expected to start test on P element but found {$p->get_tag()} instead." );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -172,7 +172,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers WP_HTML_Processor::step_in_body
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_in_body_any_other_end_tag_with_unclosed_non_special_element() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( '<div><span><code></span><div>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( '<div><span><code></span><div>' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $p->next_tag( 'CODE' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( 'CODE', $p->get_tag(), "Expected to start test on CODE element but found {$p->get_tag()} instead." );
</span></span></pre></div>
<a id="trunktestsphpunittestshtmlapiwpHtmlSupportRequiredHtmlProcessorphp"></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/wpHtmlSupportRequiredHtmlProcessor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/html-api/wpHtmlSupportRequiredHtmlProcessor.php 2023-10-05 17:13:09 UTC (rev 56789)
+++ trunk/tests/phpunit/tests/html-api/wpHtmlSupportRequiredHtmlProcessor.php   2023-10-05 22:40:48 UTC (rev 56790)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -42,7 +42,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $tag_name the HTML Processor should abort when encountering this tag, e.g. "BUTTON".
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        private function ensure_support_is_added_everywhere( $tag_name ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( "<$tag_name>" );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( "<$tag_name>" );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertFalse( $p->step(), "Must support terminating elements in specific scope check before adding support for the {$tag_name} element." );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span></span></pre></div>
<a id="trunktestsphpunittestshtmlapiwpHtmlSupportRequiredOpenElementsphp"></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/wpHtmlSupportRequiredOpenElements.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/html-api/wpHtmlSupportRequiredOpenElements.php  2023-10-05 17:13:09 UTC (rev 56789)
+++ trunk/tests/phpunit/tests/html-api/wpHtmlSupportRequiredOpenElements.php    2023-10-05 22:40:48 UTC (rev 56790)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -44,7 +44,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $tag_name the HTML Processor should abort when encountering this tag, e.g. "BUTTON".
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        private function ensure_support_is_added_everywhere( $tag_name ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $p = WP_HTML_Processor::createFragment( "<$tag_name>" );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $p = WP_HTML_Processor::create_fragment( "<$tag_name>" );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertFalse( $p->step(), "Must support terminating elements in specific scope check before adding support for the {$tag_name} element." );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span></span></pre>
</div>
</div>

</body>
</html>