<!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>[56565] trunk/src/wp-includes/html-api/class-wp-html-processor.php: HTML API: Update documentation and rename internal variable on HTML Processor</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/56565">56565</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/56565","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>Bernhard Reiter</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-09-13 13:00:59 +0000 (Wed, 13 Sep 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: Update documentation and rename internal variable on HTML Processor
This patch updates documentation and an internal variable name within the
HTML Processor class so that they are more helpful and complete to a reader.
There should be no functional or visual changes in this patch.
Props dmsnell, mukesh27.
Fixes <a href="https://core.trac.wordpress.org/ticket/59267">#59267</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludeshtmlapiclasswphtmlprocessorphp">trunk/src/wp-includes/html-api/class-wp-html-processor.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-09-13 12:53:32 UTC (rev 56564)
+++ trunk/src/wp-includes/html-api/class-wp-html-processor.php 2023-09-13 13:00:59 UTC (rev 56565)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -27,6 +27,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * - Unwrapping a tag by removing its parent.
</span><span class="cx" style="display: block; padding: 0 10px"> * - Inserting and removing nodes.
</span><span class="cx" style="display: block; padding: 0 10px"> * - Reading and changing inner content.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * - Navigating up or around HTML structure.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * ## Usage
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -66,7 +67,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * `array( 'IMG' )` matches all IMG elements and `array( 'P', 'IMG' )`
</span><span class="cx" style="display: block; padding: 0 10px"> * matches all IMG elements directly inside a P element. To ensure that no
</span><span class="cx" style="display: block; padding: 0 10px"> * partial matches erroneously match it's possible to specify in a query
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * the full breadcrumb match.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * the full breadcrumb match all the way down from the root HTML element.
</ins><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><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -76,7 +77,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * $html = '<figure><img><figcaption>A <em>lovely</em> day outside</figcaption></figure>';
</span><span class="cx" style="display: block; padding: 0 10px"> * // ---- Matches here.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * $processor->next_tag( array( 'breadcrumbs' => array( 'FIGURE', 'IMG', 'FIGCAPTION', 'EM' ) ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * $processor->next_tag( array( 'breadcrumbs' => array( 'FIGURE', 'FIGCAPTION', 'EM' ) ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * $html = '<div><img></div><img>';
</span><span class="cx" style="display: block; padding: 0 10px"> * // ----- Matches here, because IMG must be a direct child of the implicit BODY.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -100,7 +101,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * - Links: A.
</span><span class="cx" style="display: block; padding: 0 10px"> * - The formatting elements: B, BIG, CODE, EM, FONT, I, SMALL, STRIKE, STRONG, TT, U.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * - Containers: DIV, FIGCAPTION, FIGURE.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * - Containers: DIV, FIGCAPTION, FIGURE, SPAN.
+ * - Form elements: BUTTON.
</ins><span class="cx" style="display: block; padding: 0 10px"> * - Paragraph: P.
</span><span class="cx" style="display: block; padding: 0 10px"> * - Void elements: IMG.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -116,7 +118,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * - Markup involving only those tags listed above.
</span><span class="cx" style="display: block; padding: 0 10px"> * - Fully-balanced and non-overlapping tags.
</span><span class="cx" style="display: block; padding: 0 10px"> * - HTML with unexpected tag closers.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * - Some unbalanced or overlapping tags.
</ins><span class="cx" style="display: block; padding: 0 10px"> * - P tags after unclosed P tags.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * - BUTTON tags after unclosed BUTTON tags.
</ins><span class="cx" style="display: block; padding: 0 10px"> * - A tags after unclosed A tags that don't involve any active formatting elements.
</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="lines" style="display: block; padding: 0 10px; color: #888">@@ -126,8 +130,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class WP_HTML_Processor extends WP_HTML_Tag_Processor {
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * HTML processing requires more bookmarks than basic tag processing.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The maximum number of bookmarks allowed to exist at any given time.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * HTML processing requires more bookmarks than basic tag processing,
+ * so this class constant from the Tag Processor is overwritten.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @since 6.4.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var int
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -137,6 +144,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Static query for instructing the Tag Processor to visit every token.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @access private
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @since 6.4.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var array
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -158,8 +167,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Used to create unique bookmark names.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This class sets a bookmark for every tag in the HTML document that it encounters.
+ * The bookmark name is auto-generated and increments, starting with `1`. These are
+ * internal bookmarks and are automatically released when the referring WP_HTML_Token
+ * goes out of scope and is garbage-collected.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @since 6.4.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @see WP_HTML_Processor::$release_internal_bookmark_on_destruct
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @var int
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> private $bookmark_counter = 0;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -186,7 +202,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var closure
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- private $release_internal_bookmark = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ private $release_internal_bookmark_on_destruct = null;
</ins><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"> * Public Interface Functions
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -258,10 +274,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Constructor.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Do not use this method. Use the static creator methods instead.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @access private
</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><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @see WP_HTML_Processor::createFragment()
+ *
</ins><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="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -287,7 +307,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * a private method into WP_HTML_Token classes without
</span><span class="cx" style="display: block; padding: 0 10px"> * exposing it to any public API.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->release_internal_bookmark = function ( $name ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->release_internal_bookmark_on_destruct = function ( $name ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> parent::release_bookmark( $name );
</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">@@ -298,13 +318,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Various situations lead to parsing failure but this class will
</span><span class="cx" style="display: block; padding: 0 10px"> * return `false` in all those cases. To determine why something
</span><span class="cx" style="display: block; padding: 0 10px"> * failed it's possible to request the last error. This can be
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * helpful to know if it's possible to fix something or to give up.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * helpful to know to distinguish whether a given tag couldn't
+ * be found or if content in the document caused the processor
+ * to give up and abort processing.
</ins><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">- * $p = WP_HTML_Processor::createFragment( '<template><strong><button><em><p><em>' );
- * false === $p->next_tag();
- * WP_HTML_Processor::ERROR_UNSUPPORTED === $p->get_last_error();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * $processor = WP_HTML_Processor::createFragment( '<template><strong><button><em><p><em>' );
+ * false === $processor->next_tag();
+ * WP_HTML_Processor::ERROR_UNSUPPORTED === $processor->get_last_error();
</ins><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><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -429,6 +451,20 @@
</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"> if ( self::PROCESS_NEXT_NODE === $node_to_process ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * Void elements still hop onto the stack of open elements even though
+ * there's no corresponding closing tag. This is important for managing
+ * stack-based operations such as "navigate to parent node" or checking
+ * on an element's breadcrumbs.
+ *
+ * When moving on to the next node, therefore, if the bottom-most element
+ * on the stack is a void element, it must be closed.
+ *
+ * @TODO: Once self-closing foreign elements and BGSOUND are supported,
+ * they must also be implicitly closed here too. BGSOUND is
+ * special since it's only self-closing if the self-closing flag
+ * is provided in the opening tag, otherwise it expects a tag closer.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $top_node = $this->state->stack_of_open_elements->current_node();
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $top_node && self::is_void( $top_node->node_name ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->state->stack_of_open_elements->pop();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -446,7 +482,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->bookmark_tag(),
</span><span class="cx" style="display: block; padding: 0 10px"> $this->get_tag(),
</span><span class="cx" style="display: block; padding: 0 10px"> $this->is_tag_closer(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->release_internal_bookmark
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->release_internal_bookmark_on_destruct
</ins><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"> try {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -456,7 +492,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> default:
</span><span class="cx" style="display: block; padding: 0 10px"> $this->last_error = self::ERROR_UNSUPPORTED;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- throw new WP_HTML_Unsupported_Exception( 'Cannot parse outside of the IN BODY insertion mode.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ throw new WP_HTML_Unsupported_Exception( "No support for parsing in the '{$this->state->insertion_mode}' state." );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } catch ( WP_HTML_Unsupported_Exception $e ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -470,17 +506,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Computes the HTML breadcrumbs for the currently-matched node, if matched.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Breadcrumbs start at the outer-most parent and descend toward the matched element.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Breadcrumbs start at the outermost parent and descend toward the matched element.
+ * They always include the entire path from the root HTML node to the matched element.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @TODO: It could be more efficient to expose a generator-based version of this function
+ * to avoid creating the array copy on tag iteration. If this is done, it would likely
+ * be more useful to walk up the stack when yielding instead of starting at the top.
+ *
</ins><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">- * $p = WP_HTML_Processor::createFragment( '<p><strong><em><img></em></strong></p>' );
- * $p->next_tag( 'IMG' );
- * $p->get_breadcrumbs() === array( 'HTML', 'BODY', 'P', 'STRONG', 'EM', 'IMG' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * $processor = WP_HTML_Processor::createFragment( '<p><strong><em><img></em></strong></p>' );
+ * $processor->next_tag( 'IMG' );
+ * $processor->get_breadcrumbs() === array( 'HTML', 'BODY', 'P', 'STRONG', 'EM', 'IMG' );
</ins><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">- * @return string[]|null Array of tag-names representing path to matched node, if matched, otherwise null.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string[]|null Array of tag names representing path to matched node, if matched, otherwise NULL.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_breadcrumbs() {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $this->get_tag() ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -499,16 +540,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Parses next element in the 'in body' insertion mode.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * This internal function performs the 'in body' insertion mode
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * logic for the generalized `self::step()` function.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * logic for the generalized WP_HTML_Processor::step() function.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @access private
- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @since 6.4.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @see https://html.spec.whatwg.org/#parsing-main-inbody
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @see self::step
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @see WP_HTML_Processor::step
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool Whether an element was found.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -698,7 +737,7 @@
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Creates a new bookmark for the currently-matched tag and returns generated name.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Creates a new bookmark for the currently-matched tag and returns the generated name.
</ins><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><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -726,14 +765,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Returns the uppercase name of the matched tag.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The semantic rules for HTML specify that certain tags be reprocessed
+ * with a different tag name. Because of this, the tag name presented
+ * by the HTML Processor may differ from the one reported by the HTML
+ * Tag Processor, which doesn't apply these semantic rules.
+ *
</ins><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">- * $p = new WP_HTML_Tag_Processor( '<div class="test">Test</div>' );
- * $p->next_tag() === true;
- * $p->get_tag() === 'DIV';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * $processor = new WP_HTML_Tag_Processor( '<div class="test">Test</div>' );
+ * $processor->next_tag() === true;
+ * $processor->get_tag() === 'DIV';
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * $p->next_tag() === false;
- * $p->get_tag() === null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * $processor->next_tag() === false;
+ * $processor->get_tag() === null;
</ins><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><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -775,11 +819,13 @@
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Moves the internal cursor in the Tag Processor to a given bookmark's location.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Moves the internal cursor in the HTML Processor to a given bookmark's location.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * In order to prevent accidental infinite loops, there's a
</span><span class="cx" style="display: block; padding: 0 10px"> * maximum limit on the number of times seek() can be called.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @throws Exception When unable to allocate a bookmark for the next token in the input HTML document.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @since 6.4.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $bookmark_name Jump to the place in the document identified by this bookmark name.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1348,6 +1394,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * This unlock code is used to ensure that anyone calling the constructor is
</span><span class="cx" style="display: block; padding: 0 10px"> * doing so with a full understanding that it's intended to be a private API.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
+ * @access private
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> const CONSTRUCTOR_UNLOCK_CODE = 'Use WP_HTML_Processor::createFragment instead of calling the class constructor directly.';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>