Opened 6 weeks ago
Last modified 2 weeks ago
#65383 new enhancement
HTML API: Performance and other improvements in 7.1
| Reported by: | dmsnell | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.1 |
| 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 (12)
This ticket was mentioned in PR #12037 on WordPress/wordpress-develop by @dmsnell.
6 weeks ago
#1
- Keywords has-patch added
This ticket was mentioned in PR #12229 on WordPress/wordpress-develop by @jonsurrell.
3 weeks 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.
3 weeks 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:
3 weeks 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.
3 weeks ago
#6
@dmsnell commented on PR #12292:
3 weeks 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:
3 weeks 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:
3 weeks ago
#10
Merged in r62563.
@jonsurrell commented on PR #12229:
3 weeks 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:
2 weeks 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.