wordpress-develop/src/wp-includes/html-api
Tonya Mork 83ae6b790e HTML API: Fix finding bookmarks set on closing tag WP_HTML_Tag_Processor.
Setting a bookmark on a tag should set its "start" position before the opening "<", e.g.:
{{{
<div> Testing a <b>Bookmark</b>
----------------^
}}}

The previous calculation assumed this is always one byte to the left from `$tag_name_starts_at`.

However, in a closing tag that index points to a solidus symbol "/":
{{{
<div> Testing a <b>Bookmark</b>
----------------------------^
}}}

The bookmark should therefore start two bytes before the tag name:
{{{
<div> Testing a <b>Bookmark</b>
---------------------------^
}}}

This changeset achieves this by:
* Using the correct starting index for closing tag bookmarks.
* Adding `array( 'tag_closers' => 'visit' )` in `WP_HTML_Tag_Processor::seek()`.

Follow-up to [55203].

Props zieladam, dmsnell, flixos90.
Fixes #57787.
See #57575.

git-svn-id: https://develop.svn.wordpress.org/trunk@55407 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-22 20:53:41 +00:00
..
class-wp-html-attribute-token.php Introduce HTML API with HTML Tag Processor 2023-02-03 01:03:59 +00:00
class-wp-html-span.php Introduce HTML API with HTML Tag Processor 2023-02-03 01:03:59 +00:00
class-wp-html-tag-processor.php HTML API: Fix finding bookmarks set on closing tag WP_HTML_Tag_Processor. 2023-02-22 20:53:41 +00:00
class-wp-html-text-replacement.php Introduce HTML API with HTML Tag Processor 2023-02-03 01:03:59 +00:00