Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Block Bindings: Reuse bookmark instead of releasing
  • Loading branch information
ockham committed Sep 24, 2025
commit 38be2546ae62ec33184bb9a9b7df5e8193a14ea7
10 changes: 4 additions & 6 deletions src/wp-includes/class-wp-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,20 +493,18 @@ public function replace_rich_text( $rich_text ) {

$depth = $this->get_current_depth();

$this->set_bookmark( '_wp_block_bindings_tag_opener' );
$this->set_bookmark( '_wp_block_bindings' );
// The bookmark names are prefixed with `_` so the key below has an extra `_`.
$tag_opener = $this->bookmarks['__wp_block_bindings_tag_opener'];
$tag_opener = $this->bookmarks['__wp_block_bindings'];
$start = $tag_opener->start + $tag_opener->length;
$this->release_bookmark( '_wp_block_bindings_tag_opener' );

// Find matching tag closer.
while ( $this->next_token() && $this->get_current_depth() >= $depth ) {
}

$this->set_bookmark( '_wp_block_bindings_tag_closer' );
$tag_closer = $this->bookmarks['__wp_block_bindings_tag_closer'];
$this->set_bookmark( '_wp_block_bindings' );
$tag_closer = $this->bookmarks['__wp_block_bindings'];
$end = $tag_closer->start;
$this->release_bookmark( '_wp_block_bindings_tag_closer' );

$this->lexical_updates[] = new WP_HTML_Text_Replacement(
$start,
Expand Down
Loading