Opened 6 months ago
Last modified 4 months ago
#65383 new enhancement
HTML API: Performance and other improvements in 7.1
| Reported by: | dmsnell | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | HTML API | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description (last modified by )
Tracking ticket for updates to the HTML API itself in 7.1.
- Interface enhancements
- Performance improvements
- Spec-compatability improvements
- Other internal details.
Previously:
- 6.9: #63738
Change History (15)
This ticket was mentioned in PR #12037 on WordPress/wordpress-develop by @dmsnell.
6 months ago
#1
- Keywords has-patch added
This ticket was mentioned in PR #12229 on WordPress/wordpress-develop by @jonsurrell.
5 months ago
#3
- Keywords has-unit-tests added
Implement _adoption agency algorithm's_ "any other end tag" case.
This does not fully implement the remaining _adoption agency algorithm_ support, only the "any other end tag" case. Additional support can be added separately.
Notably this supports HTML like the following, which the WordPress editor is known to produce:
<a><a></a></a>
(Correctly produces to `A` siblings on this branch, unsupported in 7.0)
Compared with trunk, 6 html5lib tests are now supported:
<b><table><td></b><i></table>X<select><b><option><select><option></b></select>X(this is legacy SELECT behavior, see #9298)<b>Test</i>Test<b><table><td></b><i></table><select><b><option><select><option></b></select>(this is legacy SELECT behavior, see #9298)</strong></b></em></i></u></strike></s></blink></tt></pre></big></small></font></select></h1></h2></h3></h4></h5></h6></body></br></a></img></title></span></style></script></table></th></td></tr></frame></area></link></param></hr></input></col></base></meta></basefont></bgsound></embed></spacer></p></dd></dt></caption></colgroup></tbody></tfoot></thead></address></blockquote></center></dir></div></dl></fieldset></listing></menu></ol></ul></li></nobr></wbr></form></button></marquee></object></html></frameset></head></iframe></image></isindex></noembed></noframes></noscript></optgroup></option></plaintext></textarea>
Trac ticket: https://core.trac.wordpress.org/ticket/65383
Alternate to #6983 which adds support for all _adoption agency algorithm_ behaviors.
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude, Codex
Used for: Fuzz testing.
This ticket was mentioned in PR #12267 on WordPress/wordpress-develop by @jonsurrell.
5 months ago
#4
Moves _in body_ insertion mode's "any other end tag" processing to a separate method.
These instructions may be run from the main step_in_body() processing or via the _adoption agency algorithm_ (see https://github.com/WordPress/wordpress-develop/pull/12229). The new method can be invoked as necessary.
Trac ticket: https://core.trac.wordpress.org/ticket/65383
## Use of AI Tools
AI assistance: No
@jonsurrell commented on PR #12229:
5 months ago
#5
https://github.com/WordPress/wordpress-develop/pull/12267 moves "any other end tag" to its own method.
This ticket was mentioned in PR #12292 on WordPress/wordpress-develop by @dmsnell.
5 months ago
#6
@dmsnell commented on PR #12292:
5 months ago
#7
@sirreal I had Codex attempt to merge the two prior PRs into this, as well as rebuild it from trunk. Not yet have I verified if it did it properly.
I did notice in reviewing the older versions how valuable it will be to have in_body_any_other_end_tag() as a separate method.
@jonsurrell commented on PR #12292:
5 months ago
#8
https://github.com/WordPress/wordpress-develop/pull/12267 is the isolated "any other end tag" method. I'll plan to land that.
@jonsurrell commented on PR #12267:
5 months ago
#10
Merged in r62563.
@jonsurrell commented on PR #12229:
5 months ago
#11
https://github.com/whatwg/html/issues/9559 is relevant for adoption agency algorithm. The spec was updated for clarity.
@dmsnell commented on PR #12292:
5 months ago
#12
thanks @sirreal — I had already rebased this on your work but hadn’t pushed it.
right now it’s supposed to be creating a Tag Processor at the token referenced during reconstruction to get the attributes from it (as opposed to eagerly caching those as we parse).
was planning on doing some testing to see what turns up in realistic HTML on those approaches.
This ticket was mentioned in Slack in #core by adrianduffell. View the logs.
4 months ago
#14
@
4 months ago
- Milestone 7.1 → Future Release
This was discussed in today’s bug scrub. With the 7.1 beta just hours away, it looks like this will partially make it into 7.1 with PR (https://github.com/WordPress/wordpress-develop/pull/12267, and I will punt the remainder.
Is it is also possible to fill in the ticket description with more details about the changes?
#15
@
4 months ago
@adrianduffell as a tracking ticket this is brad in nature. the individual changes referencing it will have more information, at least those which are merged.
For now, there appears to be no significant change for 7.1; just an internal refactor that supports the other PRs linked to this ticket.
Trac ticket: Core-65383
The push and pop handlers in the HTML API were convenient when initially building the class, but being indirect, they involve an overhead when calling and require additional protection for avoiding calling the wrong handlers when and if an instance of the class were to be unserialized.
This patch replaces the direct calls by modifying the return values of the methods in the Open Elements calss to return pushed or popped elements. This makes it possible for the HTML Processor to track its own accounting directly while still delegating the stack operations to the Open Elements.
Patch developed by Codex on instruction from dmsnell.