#61646 closed enhancement (fixed)
HTML API: Improvements to testing and verification in 6.7
Reported by: | dmsnell | Owned by: | |
---|---|---|---|
Milestone: | 6.7 | Priority: | normal |
Severity: | normal | Version: | 6.6 |
Component: | HTML API | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
It's important that the HTML API remain spec-compliant and that we can understand how it performs on real content in realistic situations.
This is a tracking ticket for work to improve the verification and testing and measurement of various parts of the HTML API during the WordPress 6.7 release/
Change History (27)
This ticket was mentioned in PR #6985 on WordPress/wordpress-develop by @dmsnell.
6 months ago
#1
- Keywords has-patch added
This ticket was mentioned in PR #7030 on WordPress/wordpress-develop by @jonsurrell.
6 months ago
#4
- Keywords has-unit-tests added
- Use get_token_name over get_tag
- Prefer assertSame
Follow-up to:
Trac ticket: https://core.trac.wordpress.org/ticket/61646
This ticket was mentioned in PR #7117 on WordPress/wordpress-develop by @jonsurrell.
6 months ago
#7
Trac ticket: Core-61646
- Tests: 609, Assertions: 405, Skipped: 204. + Tests: 1486, Assertions: 716, Skipped: 770.
6 months ago
#8
@sirreal I've added active format reconstruction to the PLAINTEXT
element, even though it's missing from the spec, but all the major parsers clearly perform this. I've submitted a PR to the HTML spec to add the rule.
5 months ago
#9
Leaving a note for posterity's sake: adding active format reconstruction to PLAINTEXT is wrong. Adding PLAINTEXT is more complicated than it originally seemed, because even though every remaining token is a character token, if there are any character tokens left, they may trigger active format reconstruction. This is something I'll try and fix
5 months ago
#10
Fragment support extracted into https://github.com/WordPress/wordpress-develop/pull/7141 where I thought I had already done so, sorry!
@jonsurrell commented on PR #7117:
5 months ago
#11
Thanks, I'll revert the changes to support arbitrary fragments here and continue to only support body
. That work is more complicated and can continue in #7141.
This ticket was mentioned in PR #7174 on WordPress/wordpress-develop by @jonsurrell.
5 months ago
#14
Trac ticket: https://core.trac.wordpress.org/ticket/61646
Remove todo comments related to work that has been completed.
This ticket was mentioned in PR #7186 on WordPress/wordpress-develop by @jonsurrell.
5 months ago
#16
The HTML API allowed tests to be skipped for unsupported HTML, for
example tags that had not yet been implemented.
In many places, the tags are fully supported and the test skips can be
removed.
Trac ticket: https://core.trac.wordpress.org/ticket/61646
This ticket was mentioned in PR #7285 on WordPress/wordpress-develop by @jonsurrell.
5 months ago
#19
Improve unsupported markup skipped test information.
The html5lib-tests suite skips a number of tests due to unsupported markup. At the moment, these tests all report "Test includes unsupported markup." Use the get_unsupported_exception
method to improve these skip messages so they're more informative: "Unsupported markup: Foster parenting is not supported."
There is no diff in the test statistics comparing this branch to trunk.
To test this, run the following and the improved error messages will be shown:
phpunit --group html-api-html5lib-tests --verbose
Trac ticket: https://core.trac.wordpress.org/ticket/61646
5 months ago
#20
@sirreal I added new sections to throw an error on incomplete input and on an error that isn't unsupported markup (e.g. out of bookmarks)
This ticket was mentioned in PR #7346 on WordPress/wordpress-develop by @jonsurrell.
4 months ago
#23
Applies some improvements extracted from https://github.com/dmsnell/wordpress-develop/pull/22 to HTML API Html5lib-tests for tests with fragments.
- The document fragment should be trimmed, not split. This maintains (currently unsupported) contexts like
svg rect
but fixes previously broken contexts that should be supported likebody
(wasbody\n
). - Previously, fragments were used instead of full processors. In these cases, parts of the tree before
body
were always missing and the part of the tree before body was artificially constructed. This is no longer necessary and is wrong in fragments and is removed. - Move a static indent text for tree construction
" "
from a local variable to a class constant.
Test improvements from trunk:
OK, but incomplete, skipped, or risky tests! -Tests: 1500, Assertions: 1079, Skipped: 421. +Tests: 1505, Assertions: 1084, Skipped: 421.
There are likely 5 tests with a body
document context that were hidden because its context was reported as body\n
.
Trac ticket: https://core.trac.wordpress.org/ticket/61646
#25
@
4 months ago
@dmsnell Are there any more planned changes prior to beta 1? If not, let's close this one out and create bug tickets as necessary.
Trac ticket: Core-61646
The HTML Processor internally throws an exception when it reaches HTML
that it knows it cannot process, but this exception is not made
available to calling code. It can be useful to extract more knowledge
about why it gave up, especially for debugging purposes.
In this patch, more context is added to the WP_HTML_Unsupported_Exception
and the last exception is made available to calling code, if it asks.