diff --git a/src/wp-includes/html-api/class-wp-html-processor.php b/src/wp-includes/html-api/class-wp-html-processor.php index 25603d9521a89..5c3463dae237a 100644 --- a/src/wp-includes/html-api/class-wp-html-processor.php +++ b/src/wp-includes/html-api/class-wp-html-processor.php @@ -416,7 +416,14 @@ public function next_tag( $query = null ) { /** * Steps through the HTML document and stop at the next token, if any. * - * Currently only supports stepping through tags. + * Currently only supports stepping through tags; do not use until this + * supports visiting text nodes. This is necessary for now to ensure that + * the Tag Processor doesn't bypass the HTML semantic rules in this class + * when seeking to a bookmark. + * + * @since 6.5.0 Added for internal support; do not use. + * + * @access private * * @return bool */ diff --git a/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php b/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php index b9d567fbebed6..2e78d6a36bbef 100644 --- a/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php +++ b/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php @@ -515,7 +515,11 @@ public function test_can_query_an_element_by_tag_name() { * @covers WP_HTML_Processor::seek */ public function test_can_seek_back_and_forth() { - $p = WP_HTML_Processor::create_fragment( '
' ); + $p = WP_HTML_Processor::create_fragment( + <<<'HTML' +
more stuff
three comes soon
' ); +HTML + ); // Find first tag of interest. while ( $p->next_tag() && null === $p->get_attribute( 'one' ) ) {