HTML API: Scan to end of tag when getting updated HTML output.

When applying updates to HTML, one step was left out in [56941] which updated the position of the end of the current tag. This made it possible to create bookmarks with null or earlier end positions than their start position. This in turn broke the Directive Processor in Gutenberg during the backport of changes from Core into Gutenberg.

In this commit, after applying updates, the HTML document is now scanned fully to the end of the current tag, updating the internal pointer to its end, so that nothing else will be broken or misaligned.

Follow-up to [56941].

Props dmsnell.
Fixes #59643.
Built from https://develop.svn.wordpress.org/trunk@56953


git-svn-id: http://core.svn.wordpress.org/trunk@56464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2023-10-17 10:39:27 +00:00
parent 41a5f69fde
commit fe3efe9810
2 changed files with 5 additions and 1 deletions

View File

@ -2324,6 +2324,10 @@ class WP_HTML_Tag_Processor {
continue;
}
$tag_ends_at = strpos( $this->html, '>', $this->bytes_already_parsed );
$this->tag_ends_at = $tag_ends_at;
$this->bytes_already_parsed = $tag_ends_at;
return $this->html;
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.4-beta4-56952';
$wp_version = '6.4-beta4-56953';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.