Skip to content

Commit

Permalink
WP_HTML_Tag_Processor: Support tag closer bookmarks (#48692)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ockham committed Mar 2, 2023
1 parent 580b4f8 commit 0feaa9d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down Expand Up @@ -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' ) );
}

/**
Expand Down

0 comments on commit 0feaa9d

Please sign in to comment.