#59993 closed enhancement (fixed)
HTML API: Track spans of text with (offset, length) instead of (start, end)
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.5 | Priority: | normal |
Severity: | normal | Version: | 6.5 |
Component: | HTML API | Keywords: | has-patch needs-dev-note |
Focuses: | Cc: |
Description
This patch follows-up with earlier design questions around how to represent spans of strings inside the class. It's relevant now as preparation for #5683.
The mixture of (offset, length) and (start, end) coordinates becomes confusing at times and all final string operations are performed with the (offset, length) pair, since these feed into strlen().
In preparation for exposing all tokens within an HTML document this change:
Unifies the representation throughout the class.
It creates token_starts_at to track the start of the current token.
It replaces tag_ends_at with token_length for re-use with other token types.
There should be no functional or behavioral changes in this patch.
For the internal helper classes this patch introduces breaking changes, but those classes are marked private and should not be used outside of the HTML API itself.
Change History (5)
#2
@
15 months ago
I have noticed that this changeset leads to PHP Fatal errors when used with the latest Gutenberg plugin ( tested with 17.2.3 and 17.3.0 RC1 ) as the plugin is extending some of the affected classes and is expecting the original properties (start, end).
I have reported the issue in Gutenberg repository ( https://github.com/WordPress/gutenberg/issues/57216 ), but wanted to flag it here as well despite the commit description mentioning the breaking changes.
#3
@
14 months ago
With changeset in trunk during 6.5
, please milestone the ticket to 6.5
@zieladam, thanks!
In 57179: