diff --git a/lib/compat/wordpress-6.2/html-api/class-wp-html-tag-processor.php b/lib/compat/wordpress-6.2/html-api/class-wp-html-tag-processor.php
index 42675ecd3cf91d..044d1f0c366587 100644
--- a/lib/compat/wordpress-6.2/html-api/class-wp-html-tag-processor.php
+++ b/lib/compat/wordpress-6.2/html-api/class-wp-html-tag-processor.php
@@ -722,7 +722,7 @@ public function set_bookmark( $name ) {
}
$this->bookmarks[ $name ] = new WP_HTML_Span(
- $this->tag_name_starts_at - 1,
+ $this->tag_name_starts_at - ( $this->is_closing_tag ? 2 : 1 ),
$this->tag_ends_at
);
@@ -1504,7 +1504,7 @@ public function seek( $bookmark_name ) {
$this->bytes_already_parsed = $this->bookmarks[ $bookmark_name ]->start;
$this->bytes_already_copied = $this->bytes_already_parsed;
$this->output_buffer = substr( $this->html, 0, $this->bytes_already_copied );
- return $this->next_tag();
+ return $this->next_tag( array( 'tag_closers' => 'visit' ) );
}
/**