[wp-trac] [WordPress Trac] #57787: WP_HTML_Tag_Processor::seek() off by 1 byte when seeking bookmarks set on a closing tag
WordPress Trac
noreply at wordpress.org
Thu Feb 23 14:34:21 UTC 2023
#57787: WP_HTML_Tag_Processor::seek() off by 1 byte when seeking bookmarks set on a
closing tag
-------------------------------------------------+-------------------------
Reporter: zieladam | Owner:
| hellofromTonya
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.2
Component: Editor | Version: trunk
Severity: normal | Resolution: fixed
Keywords: gutenberg-merge has-patch has-unit- | Focuses:
tests commit |
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):
* status: reviewing => closed
* resolution: => fixed
Comment:
In [changeset:"55407" 55407]:
{{{
#!CommitTicketReference repository="" revision="55407"
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.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57787#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list