diff --git a/wp-includes/html-api/class-wp-html-processor.php b/wp-includes/html-api/class-wp-html-processor.php
index e3100abc69..c2349d8a28 100644
--- a/wp-includes/html-api/class-wp-html-processor.php
+++ b/wp-includes/html-api/class-wp-html-processor.php
@@ -508,6 +508,44 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
return false;
}
+ /**
+ * Indicates if the currently-matched node expects a closing
+ * token, or if it will self-close on the next step.
+ *
+ * Most HTML elements expect a closer, such as a P element or
+ * a DIV element. Others, like an IMG element are void and don't
+ * have a closing tag. Special elements, such as SCRIPT and STYLE,
+ * are treated just like void tags. Text nodes and self-closing
+ * foreign content will also act just like a void tag, immediately
+ * closing as soon as the processor advances to the next token.
+ *
+ * @since 6.6.0
+ *
+ * @todo When adding support for foreign content, ensure that
+ * this returns false for self-closing elements in the
+ * SVG and MathML namespace.
+ *
+ * @return bool Whether to expect a closer for the currently-matched node,
+ * or `null` if not matched on any token.
+ */
+ public function expects_closer() {
+ $token_name = $this->get_token_name();
+ if ( ! isset( $token_name ) ) {
+ return null;
+ }
+
+ return ! (
+ // Comments, text nodes, and other atomic tokens.
+ '#' === $token_name[0] ||
+ // Doctype declarations.
+ 'html' === $token_name ||
+ // Void elements.
+ self::is_void( $token_name ) ||
+ // Special atomic elements.
+ in_array( $token_name, array( 'IFRAME', 'NOEMBED', 'NOFRAMES', 'SCRIPT', 'STYLE', 'TEXTAREA', 'TITLE', 'XMP' ), true )
+ );
+ }
+
/**
* Steps through the HTML document and stop at the next tag, if any.
*
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 1cfc031679..da5ee3053b 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.6-alpha-58191';
+$wp_version = '6.6-alpha-58192';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.