Skip to content

Commit 62ad881

Browse files
authored
WP_HTML_Tag_Processor: Support tag closer bookmarks (#48692)
In the 6.2 compat layer, support bookmarks pointing to closing tags. This is for parity with Core in WP 6.2, see WordPress/wordpress-develop#4115 and [r55407](https://core.trac.wordpress.org/changeset/55407). Note that these changes have already been backported to GB's 6.**3** compat layer in #48378. However, since the change will be in WP 6.2, we also have to apply it to GB's 6.2 compat layer.
1 parent 3676994 commit 62ad881

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/compat/wordpress-6.2/html-api/class-wp-html-tag-processor.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ public function set_bookmark( $name ) {
722722
}
723723

724724
$this->bookmarks[ $name ] = new WP_HTML_Span(
725-
$this->tag_name_starts_at - 1,
725+
$this->tag_name_starts_at - ( $this->is_closing_tag ? 2 : 1 ),
726726
$this->tag_ends_at
727727
);
728728

@@ -1504,7 +1504,7 @@ public function seek( $bookmark_name ) {
15041504
$this->bytes_already_parsed = $this->bookmarks[ $bookmark_name ]->start;
15051505
$this->bytes_already_copied = $this->bytes_already_parsed;
15061506
$this->output_buffer = substr( $this->html, 0, $this->bytes_already_copied );
1507-
return $this->next_tag();
1507+
return $this->next_tag( array( 'tag_closers' => 'visit' ) );
15081508
}
15091509

15101510
/**

0 commit comments

Comments
 (0)